mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-18 01:27:25 +00:00
Avoid unnecessary copying of the whole struct.
This commit is contained in:
@@ -73,8 +73,7 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
|
|||||||
var queryHash string
|
var queryHash string
|
||||||
var cachedResponse []byte
|
var cachedResponse []byte
|
||||||
|
|
||||||
cbc := reflect.ValueOf(*c).Interface().(BaseClient)
|
cacheBaseClient := c
|
||||||
cacheBaseClient := &cbc
|
|
||||||
|
|
||||||
query := cacheBaseClient.NewQuery(queryContent, queryVariables)
|
query := cacheBaseClient.NewQuery(queryContent, queryVariables)
|
||||||
|
|
||||||
@@ -86,7 +85,9 @@ func (c *BaseClient) Query(queryContent string, queryVariables interface{}, quer
|
|||||||
if !reflect.DeepEqual(queryHeadersModified, queryHeaders) {
|
if !reflect.DeepEqual(queryHeadersModified, queryHeaders) {
|
||||||
if cacheBaseClient.cache.enabled != c.cache.enabled && cacheBaseClient.cache.enabled {
|
if cacheBaseClient.cache.enabled != c.cache.enabled && cacheBaseClient.cache.enabled {
|
||||||
cacheBaseClient.Logger.Debug(cacheBaseClient, "Switching cache on as per single-request header")
|
cacheBaseClient.Logger.Debug(cacheBaseClient, "Switching cache on as per single-request header")
|
||||||
c.enableCache()
|
cbc := reflect.ValueOf(*c).Interface().(BaseClient)
|
||||||
|
cacheBaseClient := &cbc
|
||||||
|
cacheBaseClient.enableCache()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user