From 83edea8a66aef4d90ca5e9c6d906a48f35e45c44 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Fri, 20 Apr 2018 00:17:13 +0100 Subject: [PATCH] =?UTF-8?q?Don=E2=80=99t=20fetch=20right=20side=20of=20AND?= =?UTF-8?q?=20/=20OR=20statements=20if=20not=20necessary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/fetch.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/db/fetch.go b/db/fetch.go index 43e71d42..c8a48e7e 100644 --- a/db/fetch.go +++ b/db/fetch.go @@ -233,6 +233,17 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o return nil, err } + switch val.Op { + case sql.OR: + if calcAsBool(l) { + return true, nil + } + case sql.AND: + if !calcAsBool(l) { + return false, nil + } + } + r, err := e.fetch(ctx, val.RHS, doc) if err != nil { return nil, err