Skip to content

Instantly share code, notes, and snippets.

@pravinchandar
Last active July 7, 2022 23:58
Show Gist options
  • Select an option

  • Save pravinchandar/296e17e036b3a5c118288f4c971ee341 to your computer and use it in GitHub Desktop.

Select an option

Save pravinchandar/296e17e036b3a5c118288f4c971ee341 to your computer and use it in GitHub Desktop.
// Evaluate is an RPC proxy. It proxies the request to the main process and
// writes the response to o.
func (j JqServer) Evaluate(i *SomeInput, o *SomeOutput) error {
// setup the conduit
reqChan := make(chan RequestResponse)
req := RequestResponse{Req: i}
// send the request to the main process
j.process.ReqRespChan <- reqChan
reqChan <- req
// receive response from the main process
if res := <-reqChan; res.Error != nil {
return res.Error
}
o = res.Response
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment