field IsNull, IsNotNull methods

This commit is contained in:
2025-08-03 21:41:20 +05:30
parent 6c14441591
commit 096480a3eb
3 changed files with 20 additions and 5 deletions

10
pgm.go
View File

@@ -73,6 +73,16 @@ func (f Field) Trim() Field {
return Field("TRIM(" + f.String() + ")")
}
func (f Field) IsNull() Conditioner {
col := f.String()
return &Cond{Field: col, op: " IS NULL", len: len(col) + 8}
}
func (f Field) IsNotNull() Conditioner {
col := f.String()
return &Cond{Field: col, op: " IS NOT NULL", len: len(col) + 12}
}
// Eq is equal
func (f Field) Eq(val any) Conditioner {
col := f.String()