Yes, I ended up using this package. Thanks.
On Wed, Jan 22, 2020 at 2:35 AM robfig wrote:
> You could use json iterator’s Stream type if you prefer to feel better by
> having it wrapped in a library. It does the same thing of course. As the
> name suggests it can be used to incrementally write t
You could use json iterator’s Stream type if you prefer to feel better by
having it wrapped in a library. It does the same thing of course. As the name
suggests it can be used to incrementally write the json to a writer if that’s
what you’d like.
https://godoc.org/github.com/json-iterator/go#St
As responses coming from upstream server, because my application acting as
proxy server and it will not have visibility of the fields of the
responses coming.
So, think appending the characters to meet JSON format is only way. Am I
right assuming so?
On Mon, Jan 20, 2020 at 4:07 PM Tamás Gulácsi
Please define "better".
For complexity and speed, appending "[", inserting ",", and appending "]"
at the end is the simplest and fastest solution.
If you want to check for syntax and completeness, then you should
unmarshal, append, and then marshal again.
But if not needed, it's just complexity
Yes, I also need to put '[' at first and ']' at last position. But I was
checking if there is any better way to do it. I was even having question
how can someone make it better without unmarshalling JSON and remarshalling
merged object.
On Mon, Jan 20, 2020 at 4:12 AM Tamás Gulácsi wrote:
> Jus
Just put the missing [,] chars wher it's required with buf.WriteByte.
--
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.
To
Hello,
I am able to buffer in types.Buffer the multiple response before writing
back to client, I am hit at a problem of JSON formatting the final output.
Example: after first response buf = {...}, after second buf={...}{...}.
Now it will be returned as is, which is not in proper json format. I
Thank you for the pointers. I will dig more into them.
Thanks,
Prabhu
On Sat, Jan 18, 2020 at 12:10 PM Tamás Gulácsi wrote:
> Start simple: use a *bytes.Buffer, and help the GC with using a sync.Pool
> for those buffers.
>
> --
> You received this message because you are subscribed to the Googl
Start simple: use a *bytes.Buffer, and help the GC with using a sync.Pool for
those buffers.
--
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
Hello,
For a single request from a client, I have to make multiple upstream
requests and send a single response back to the client.
I am looking for best way to buffer in the proxy and write all at once,
where GC is not hurting the performance, seamlessly work for multiple
client request simu
10 matches
Mail list logo