[go-nuts] batch processing RESTful requests

2020-01-29 Thread Prabhu Chawandi
Hello, I am looking for information on how can I batch process REST API requests. I am having a server built using GO std library "net/http" and mongoDB being persistent storage. Do I need to create a separate endpoint to get this batch request and process in the handler? Or any other ways to

Re: [go-nuts] How to handle reading channels

2020-01-24 Thread Prabhu Chawandi
Thank you, you answered my question. I wanted to know whether I am right in doing so or something else I am missing to read a channel all at once. On Fri, Jan 24, 2020 at 8:09 PM Ian Lance Taylor wrote: > On Fri, Jan 24, 2020 at 4:25 AM Prabhu Chawandi > wrote: > > > >

[go-nuts] How to handle reading channels

2020-01-24 Thread Prabhu Chawandi
Hello, I have n routines launched before reaching this select statement. >From the routine it will fetch response from upstream server and write it to channel. When wait count reaches zero, first case will be hit. I see only one response being read, even if 10 other go routines have written

Re: [go-nuts] Best way to buffer upstream responses in reverse proxy

2020-01-22 Thread Prabhu Chawandi
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

[go-nuts] How to set-up go env properly

2020-01-22 Thread Prabhu Chawandi
Hello, I am setting up my go project directories to test. I have set up like bellow and my GOPATH is testexercise. Application builds fine, when I run from src/ github.com/arpsch/app/ But when I try to run go test handler from app folder, I am getting below error . How to organize properly.

Re: [go-nuts] Best way to buffer upstream responses in reverse proxy

2020-01-20 Thread Prabhu Chawandi
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

Re: [go-nuts] Best way to buffer upstream responses in reverse proxy

2020-01-20 Thread Prabhu Chawandi
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: >

Re: [go-nuts] Best way to buffer upstream responses in reverse proxy

2020-01-19 Thread Prabhu Chawandi
. I need to make this like [{...},{...}] Any hints to achieve this? Regards, Prabhu On Sat, Jan 18, 2020 at 9:23 PM Prabhu Chawandi wrote: > 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 > wro

Re: [go-nuts] Best way to buffer upstream responses in reverse proxy

2020-01-18 Thread Prabhu Chawandi
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

[go-nuts] Best way to buffer upstream responses in reverse proxy

2020-01-17 Thread Prabhu Chawandi
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

Re: [go-nuts] Query on Interfaces

2020-01-06 Thread Prabhu Chawandi
Thank you, it is clear now. On Tue, Jan 7, 2020 at 11:10 AM Ian Lance Taylor wrote: > On Mon, Jan 6, 2020 at 9:18 PM Prabhu Chawandi > wrote: > > > > I was reading this article @ > https://blog.golang.org/laws-of-reflection > > > > Excerpt: > > &g

[go-nuts] Query on Interfaces

2020-01-06 Thread Prabhu Chawandi
Hello, I was reading this article @ https://blog.golang.org/laws-of-reflection Excerpt: One important detail is that the pair inside an interface always has the form (value, concrete type) and cannot have the form (value, interface type). Interfaces do not hold interface values. I could not

Re: [go-nuts] Re: A question !

2020-01-04 Thread Prabhu Chawandi
Once you have little hands-on, https://medium.com/golangspec is a great place to read. On Sun, Jan 5, 2020 at 9:29 AM Michael Ellis wrote: > I came to Go from 10+ years of Python (and 20 years of C before that). Go > By Example was the online resource I found > most

Re: [go-nuts] How to fill a map with requests from client

2020-01-03 Thread Prabhu Chawandi
all["client request"] = clientJob.name// append the client requests on map Maps are Key: Value pair, in your case as the same key ie. "client request" is being used, the latest value is overwriting the previous value. Add a unique key for each request to store them in same map. On Fri, Jan 3,