Skip to content

Commit

Permalink
Allow nil query in composer
Browse files Browse the repository at this point in the history
  • Loading branch information
mainnika committed Mar 18, 2020
1 parent eeb83da commit 9f647ca
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions mongox/query/compose.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ func Compose(filters ...interface{}) *Query {
// Push applies single filter to a query
func Push(q *Query, f interface{}) bool {

if f == nil {
return true
}

ok := false
ok = ok || applyBson(q, f)
ok = ok || applyLimit(q, f)
Expand Down Expand Up @@ -91,9 +95,6 @@ func applyProtection(q *Query, f interface{}) bool {
x = &f.X
v = &f.V
case *protection.Key:
if f == nil {
return false
}
x = &f.X
v = &f.V

Expand Down

0 comments on commit 9f647ca

Please sign in to comment.