From b25f9367edd222f8589038561591813134e6fa6c Mon Sep 17 00:00:00 2001 From: Ankit Patial Date: Mon, 11 Aug 2025 23:42:58 +0530 Subject: [PATCH] using any for In/NotIn --- pgm.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pgm.go b/pgm.go index 28508b1..8120aa9 100644 --- a/pgm.go +++ b/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} } +// In using ANY func (f Field) In(val ...any) Conditioner { 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 { 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 { col := f.String() - return &Cond{Field: col, Val: qry, op: " NOT IN($)", action: CondActionSubQuery} + return &Cond{Field: col, Val: qry, op: " != ANY($)", action: CondActionSubQuery} } //