Actually that's how I'm using it as well.

I use it to deal with huge xml files and transform only those pieces that
I'm interested in. Anyway, I'm not expecting that one can fit all, but
instead, just sharing the idea how transforming can be chained together in
one particular way.

Happy hacking.

On Fri, Jul 1, 2016 at 5:08 PM, mhhcbon wrote:

> Thing is, now i read at it twice, it s not writable by essence.
> It takes an input as a whole and transform it using a pretty nice api.
>
> To take an example about why it s not suitable for me, two days ago i was
> parsing git logs, which is a text stream.
> Ideally, i do not want to load all that text into memory, then apply a big
> regexp onto it, simply because it maybe very huge.
> I d prefer to read it by chunks, then transform the data as they come,
> maintaining only a little piece of information which tells about my state
> in the parsing operation.
>
> I posted a gist of my terrible code
>
> https://gist.github.com/mh-cbon/765e80126a12357f37889db15ed7d3a5
>
> Let s see.
>
>
>
> Le vendredi 1 juillet 2016 22:53:52 UTC+2, Tong Sun a écrit :
>>
>>
>> On Fri, Jul 1, 2016 at 4:36 PM, Tong Sun wrote:
>>
>>>
>>> On Fri, Jul 1, 2016 at 4:13 PM, mhhcbon wrote:
>>>
>>>> I honestly admit i have no real understanding of what i m doing ...
>>>>
>>>
>>>
>>>> I can only figure out it works on the other end :o
>>>>
>>>> But its way more readable, to me, src -> transform -> transform -> sink
>>>>
>>>
>>> Then maybe check this one out?
>>>
>>> https://godoc.org/github.com/go-shaper/shaper#example-package--Output
>>>
>>> You can do
>>>
>>> shaper.NewFilter().ApplyToUpper().ApplyToLower().ApplyReplace("test",
>>> "biscuit", -1).ApplyRegexpReplaceAll("(?i)ht(ml)", "X$1").ApplyTrim()...
>>>
>>> and on and on, and you can build you own transform on top of that as
>>> well.
>>>
>>
>> Adding Unix2Dos() and Dos2Unix() to it is real easy, and I'd happy to
>> take the patch. Let me know if you want but unable to do it.
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/golang-nuts/rSHo0N7yDeQ/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to