Don’t fetch right side of AND / OR statements if not necessary
This commit is contained in:
parent
c4f8448345
commit
83edea8a66
1 changed files with 11 additions and 0 deletions
11
db/fetch.go
11
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
|
||||
|
|
Loading…
Reference in a new issue