Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
525c64e678 | |||
5f0fdadb8b | |||
68263895f7 | |||
ee6cb445ab |
10
pgm.go
10
pgm.go
@@ -45,17 +45,17 @@ func (f Field) Count() Field {
|
||||
}
|
||||
|
||||
// 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() + ", '')")
|
||||
}
|
||||
|
||||
// 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)")
|
||||
}
|
||||
|
||||
// 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)")
|
||||
}
|
||||
|
||||
@@ -104,8 +104,8 @@ func (f Field) Eq(val any) Conditioner {
|
||||
return &Cond{Field: col, Val: val, op: " = $", len: len(col) + 5}
|
||||
}
|
||||
|
||||
// EqualFold will user LOWER() for comparision
|
||||
func (f Field) EqFold(val any) Conditioner {
|
||||
// EqualFold will use LOWER(column_name) = LOWER(val) for comparision
|
||||
func (f Field) EqFold(val string) Conditioner {
|
||||
col := f.String()
|
||||
return &Cond{Field: "LOWER(" + col + ")", Val: val, op: " = LOWER($", action: CondActionNeedToClose, len: len(col) + 5}
|
||||
}
|
||||
|
Reference in New Issue
Block a user