func return type change
This commit is contained in:
19
pgm.go
19
pgm.go
@@ -4,11 +4,9 @@
|
||||
package pgm
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgtype"
|
||||
)
|
||||
|
||||
@@ -116,19 +114,14 @@ func PgTimeNow() pgtype.Timestamptz {
|
||||
return pgtype.Timestamptz{Time: time.Now(), Valid: true}
|
||||
}
|
||||
|
||||
// IsNotFound error check
|
||||
func IsNotFound(err error) bool {
|
||||
return errors.Is(err, pgx.ErrNoRows)
|
||||
func ConcatWs(sep string, fields ...Field) Field {
|
||||
return Field("concat_ws('" + sep + "'," + joinFileds(fields) + ")")
|
||||
}
|
||||
|
||||
func ConcatWs(sep string, fields ...Field) string {
|
||||
return "concat_ws('" + sep + "'," + joinFileds(fields) + ")"
|
||||
func StringAgg(exp, sep string) Field {
|
||||
return Field("string_agg(" + exp + ",'" + sep + "')")
|
||||
}
|
||||
|
||||
func StringAgg(exp, sep string) string {
|
||||
return "string_agg(" + exp + ",'" + sep + "')"
|
||||
}
|
||||
|
||||
func StringAggCast(exp, sep string) string {
|
||||
return "string_agg(cast(" + exp + " as varchar),'" + sep + "')"
|
||||
func StringAggCast(exp, sep string) Field {
|
||||
return Field("string_agg(cast(" + exp + " as varchar),'" + sep + "')")
|
||||
}
|
||||
|
Reference in New Issue
Block a user