Only use remote iterator fetch, if the value is a record

This commit is contained in:
Tobie Morgan Hitchcock 2019-02-01 10:49:44 +00:00
parent b6bf75c7b5
commit f8beab1e17

View file

@ -92,8 +92,15 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o
if len(path) > 0 { if len(path) > 0 {
switch res := val.(type) { switch res := val.(type) {
case []interface{}: case []interface{}:
val, _ = e.fetchArray(ctx, res, doc) for k, v := range res {
return val switch val := v.(type) {
case *sql.Thing:
res[k], _ = e.fetchThing(ctx, val, doc)
default:
res[k] = v
}
}
return res
case *sql.Thing: case *sql.Thing:
val, _ = e.fetchThing(ctx, res, doc) val, _ = e.fetchThing(ctx, res, doc)
return val return val
@ -120,8 +127,15 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o
if len(path) > 0 { if len(path) > 0 {
switch res := val.(type) { switch res := val.(type) {
case []interface{}: case []interface{}:
val, _ = e.fetchArray(ctx, res, doc) for k, v := range res {
return val switch val := v.(type) {
case *sql.Thing:
res[k], _ = e.fetchThing(ctx, val, doc)
default:
res[k] = v
}
}
return res
case *sql.Thing: case *sql.Thing:
val, _ = e.fetchThing(ctx, res, doc) val, _ = e.fetchThing(ctx, res, doc)
return val return val