Skip to content

Commit

Permalink
修复wherenotin传入空数组存在的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
tobycroft committed May 18, 2023
1 parent dcc2b79 commit b4db136
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,18 @@ func (dba *Orm) OrWhereIn(needle string, hystack []interface{}) IOrm {

// WhereNotIn ...
func (dba *Orm) WhereNotIn(needle string, hystack []interface{}) IOrm {
return dba.Where(needle, "NOT IN", hystack)
if len(hystack) > 0 {
return dba.Where(needle, "NOT IN", hystack)
}
return dba
}

// OrWhereNotIn ...
func (dba *Orm) OrWhereNotIn(needle string, hystack []interface{}) IOrm {
return dba.OrWhere(needle, "NOT IN", hystack)
if len(hystack) > 0 {
return dba.OrWhere(needle, "NOT IN", hystack)
}
return dba
}

// WhereBetween ...
Expand Down

0 comments on commit b4db136

Please sign in to comment.