Skip to content

Commit

Permalink
测试新WhereOr
Browse files Browse the repository at this point in the history
  • Loading branch information
tobycroft committed Oct 25, 2022
1 parent 1bab26c commit 4516793
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
12 changes: 3 additions & 9 deletions orm.go
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,11 @@ func (dba *Orm) Where(args ...interface{}) IOrm {
}

// Where : query or execute where condition, the relation is and
func (dba *Orm) WhereOr(args interface{}, andor bool) IOrm {
func (dba *Orm) WhereOr(args ...interface{}) IOrm {
// 如果只传入一个参数, 则可能是字符串、一维对象、二维数组
// 重新组合为长度为3的数组, 第一项为关系(and/or), 第二项为具体传入的参数 []interface{}
if andor {
w := []interface{}{"andor", args}
dba.where = append(dba.where, w)
} else {
w := []interface{}{"orand", args}
dba.where = append(dba.where, w)
}

w := []interface{}{"andor", args}
dba.where = append(dba.where, w)
return dba
}

Expand Down
2 changes: 1 addition & 1 deletion orm_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type IOrm interface {
// `Where`,`OrWhere`,`WhereNull / WhereNotNull`,`WhereIn / WhereNotIn / OrWhereIn / OrWhereNotIn`,`WhereBetween / WhereBetwee / OrWhereBetween / OrWhereNotBetween`
Where(args ...interface{}) IOrm
OrWhere(args ...interface{}) IOrm
WhereOr(args interface{}, andor bool) IOrm
WhereOr(args ...interface{}) IOrm
WhereNull(arg string) IOrm
OrWhereNull(arg string) IOrm
WhereNotNull(arg string) IOrm
Expand Down

0 comments on commit 4516793

Please sign in to comment.