Skip to content

Commit

Permalink
fix: fix bool.IS error
Browse files Browse the repository at this point in the history
  • Loading branch information
tr1v3r committed Sep 7, 2021
1 parent 1cd4e27 commit 84b7f5d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions field/expr.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package field

import (
"fmt"
"time"

"gorm.io/gorm"
Expand Down Expand Up @@ -267,6 +268,9 @@ func (e expr) not() expr {
}

func (e expr) is(value interface{}) expr {
if value, ok := value.(bool); ok {
return e.setExpression(clause.Expr{SQL: fmt.Sprintf("? IS %t", value), Vars: []interface{}{e.RawExpr()}})
}
return e.setExpression(clause.Expr{SQL: "? IS ?", Vars: []interface{}{e.RawExpr(), value}})
}

Expand Down

0 comments on commit 84b7f5d

Please sign in to comment.