From 80f532436eea9c6516a4c7a99dcb2e73194d9b88 Mon Sep 17 00:00:00 2001 From: Tobie Morgan Hitchcock Date: Tue, 5 Feb 2019 18:48:43 +0000 Subject: [PATCH] Ensure conditions in IF ELSE queries are treated as booleans --- db/fetch.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/fetch.go b/db/fetch.go index 2c9417f1..5c28150b 100644 --- a/db/fetch.go +++ b/db/fetch.go @@ -171,7 +171,7 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o if err != nil { return nil, err } - if chk, ok := ife.(bool); ok && chk { + if calcAsBool(ife) { return e.fetch(ctx, val.Then[k], doc) } } @@ -184,7 +184,7 @@ func (e *executor) fetch(ctx context.Context, val interface{}, doc *data.Doc) (o if err != nil { return nil, err } - if chk, ok := ife.(bool); ok && chk { + if calcAsBool(ife) { return e.fetch(ctx, val.Then[k], doc) } }