using any for In/NotIn
This commit is contained in:
9
pgm.go
9
pgm.go
@@ -151,19 +151,22 @@ func (f Field) ILike(val string) Conditioner {
|
|||||||
return &Cond{Field: col, Val: val, op: " ILIKE $", len: len(col) + 5}
|
return &Cond{Field: col, Val: val, op: " ILIKE $", len: len(col) + 5}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In using ANY
|
||||||
func (f Field) In(val ...any) Conditioner {
|
func (f Field) In(val ...any) Conditioner {
|
||||||
col := f.String()
|
col := f.String()
|
||||||
return &Cond{Field: col, Val: val, op: " IN($", action: CondActionNeedToClose, len: len(col) + 5}
|
return &Cond{Field: col, Val: val, op: " ANY($", action: CondActionNeedToClose, len: len(col) + 5}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotIn using ANY
|
||||||
func (f Field) NotIn(val ...any) Conditioner {
|
func (f Field) NotIn(val ...any) Conditioner {
|
||||||
col := f.String()
|
col := f.String()
|
||||||
return &Cond{Field: col, Val: val, op: " NOT IN($", action: CondActionNeedToClose, len: len(col) + 5}
|
return &Cond{Field: col, Val: val, op: " != ANY($", action: CondActionNeedToClose, len: len(col) + 5}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NotInSubQuery using ANY
|
||||||
func (f Field) NotInSubQuery(qry WhereClause) Conditioner {
|
func (f Field) NotInSubQuery(qry WhereClause) Conditioner {
|
||||||
col := f.String()
|
col := f.String()
|
||||||
return &Cond{Field: col, Val: qry, op: " NOT IN($)", action: CondActionSubQuery}
|
return &Cond{Field: col, Val: qry, op: " != ANY($)", action: CondActionSubQuery}
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
Reference in New Issue
Block a user