From f8beab1e175e880925742ba841cfa42e89945871 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 1 Feb 2019 10:49:44 +0000 Subject: [PATCH] Only use remote iterator fetch, if the value is a record --- db/fetch.go | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/db/fetch.go b/db/fetch.go index 183f932e..351cddb2 100644 --- a/db/fetch.go +++ b/db/fetch.go @@ -92,8 +92,15 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o if len(path) > 0 { switch res := val.(type) { case []interface{}: - val, _ = e.fetchArray(ctx, res, doc) - return val + for k, v := range res { + switch val := v.(type) { + case *sql.Thing: + res[k], _ = e.fetchThing(ctx, val, doc) + default: + res[k] = v + } + } + return res case *sql.Thing: val, _ = e.fetchThing(ctx, res, doc) return val @@ -120,8 +127,15 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o if len(path) > 0 { switch res := val.(type) { case []interface{}: - val, _ = e.fetchArray(ctx, res, doc) - return val + for k, v := range res { + switch val := v.(type) { + case *sql.Thing: + res[k], _ = e.fetchThing(ctx, val, doc) + default: + res[k] = v + } + } + return res case *sql.Thing: val, _ = e.fetchThing(ctx, res, doc) return val