4 Commits

Author SHA1 Message Date
525c64e678 removed toLower 2025-08-10 12:54:29 +05:30
5f0fdadb8b undo, strings.ToLower 2025-08-10 12:24:26 +05:30
68263895f7 EqFold to do value lower case 2025-08-10 11:59:01 +05:30
ee6cb445ab remove unwanted method args 2025-08-03 22:21:24 +05:30

10
pgm.go
View File

@@ -45,17 +45,17 @@ func (f Field) Count() Field {
} }
// StringEscape will return a empty string for null value // StringEscape will return a empty string for null value
func (f Field) StringEscape(arg ...any) Field { func (f Field) StringEscape() Field {
return Field("COALESCE(" + f.String() + ", '')") return Field("COALESCE(" + f.String() + ", '')")
} }
// NumberEscape will return a zero string for null value // NumberEscape will return a zero string for null value
func (f Field) NumberEscape(arg ...any) Field { func (f Field) NumberEscape() Field {
return Field("COALESCE(" + f.String() + ", 0)") return Field("COALESCE(" + f.String() + ", 0)")
} }
// BooleanEscape will return a false for null value // BooleanEscape will return a false for null value
func (f Field) BooleanEscape(arg ...any) Field { func (f Field) BooleanEscape() Field {
return Field("COALESCE(" + f.String() + ", FALSE)") return Field("COALESCE(" + f.String() + ", FALSE)")
} }
@@ -104,8 +104,8 @@ func (f Field) Eq(val any) Conditioner {
return &Cond{Field: col, Val: val, op: " = $", len: len(col) + 5} return &Cond{Field: col, Val: val, op: " = $", len: len(col) + 5}
} }
// EqualFold will user LOWER() for comparision // EqualFold will use LOWER(column_name) = LOWER(val) for comparision
func (f Field) EqFold(val any) Conditioner { func (f Field) EqFold(val string) Conditioner {
col := f.String() col := f.String()
return &Cond{Field: "LOWER(" + col + ")", Val: val, op: " = LOWER($", action: CondActionNeedToClose, len: len(col) + 5} return &Cond{Field: "LOWER(" + col + ")", Val: val, op: " = LOWER($", action: CondActionNeedToClose, len: len(col) + 5}
} }