This PR introduces an optimization on restQL's hot path.
By using a wrapper restql.ResponseBody it can avoid making the unmarshaling of HTTP response body if not needed.
In case the query demands the response values to be manipulated, like when using filters, aggregations, or chained values, the body will be parsed using the standard json.Unmarshal function.
After the body is used on computations, a new value can be set thought ResponseBody.SetValue, which accepts any value and will be used in place of the []byte read from the HTTP response.
This PR introduces an optimization on restQL's hot path.
By using a wrapper
restql.ResponseBody
it can avoid making the unmarshaling of HTTP response body if not needed.In case the query demands the response values to be manipulated, like when using filters, aggregations, or chained values, the body will be parsed using the standard
json.Unmarshal
function.After the body is used on computations, a new value can be set thought
ResponseBody.SetValue
, which accepts any value and will be used in place of the[]byte
read from the HTTP response.