@@ -391,7 +391,6 @@ func buildCompoundOperator(o interface{}, depth int, operator string) (string, b
391391 }
392392 }
393393 if depth > 0 {
394-
395394 return "(" + strings .Join (ands , operator ) + ")" , false , nil
396395 }
397396
@@ -467,7 +466,7 @@ func joinOperator(v interface{}, operator string) (string, error) {
467466 }
468467 ops := make ([]string , len (arr ))
469468 for i := 0 ; i < len (arr ); i ++ {
470- ope , err := parseOperand (arr [i ], false )
469+ ope , err := parseOperand (arr [i ], false , operator == " != " )
471470 if err != nil {
472471
473472 return "" , err
@@ -487,12 +486,12 @@ func joinSet(v interface{}, operator string) (string, error) {
487486
488487 return "" , fmt .Errorf ("set operand count must be 2" )
489488 }
490- leftOpe , err := parseOperand (arr [0 ], true )
489+ leftOpe , err := parseOperand (arr [0 ], true , false )
491490 if err != nil {
492491
493492 return "" , err
494493 }
495- rightOpe , err := parseOperand (arr [1 ], true )
494+ rightOpe , err := parseOperand (arr [1 ], true , false )
496495 if err != nil {
497496
498497 return "" , err
@@ -504,7 +503,7 @@ func joinSet(v interface{}, operator string) (string, error) {
504503 return "" , fmt .Errorf ("operator has an unexpected type" )
505504}
506505
507- func parseOperand (o interface {}, noWrap bool ) (string , error ) {
506+ func parseOperand (o interface {}, noWrap bool , negation bool ) (string , error ) {
508507 switch operandType := o .(type ) {
509508 case string :
510509
@@ -532,6 +531,10 @@ func parseOperand(o interface{}, noWrap bool) (string, error) {
532531 return expr , nil
533532 }
534533
534+ if negation {
535+ return "!(" + expr + ")" , nil
536+ }
537+
535538 return "(" + expr + ")" , nil
536539 default :
537540
0 commit comments