func return type change

This commit is contained in:
2025-07-26 21:45:09 +05:30
parent f700f3e891
commit 2ec328059f
2 changed files with 20 additions and 22 deletions

23
pool.go
View File

@@ -77,6 +77,17 @@ func InitPool(conf Config) {
poolPGX.Store(p)
}
// get string builder from pool
func getSB() *strings.Builder {
return poolStringBuilder.Get().(*strings.Builder)
}
// put string builder back to pool
func putSB(sb *strings.Builder) {
sb.Reset()
poolStringBuilder.Put(sb)
}
// GetPool instance
func GetPool() *pgxpool.Pool {
return poolPGX.Load()
@@ -93,13 +104,7 @@ func BeginTx(ctx context.Context) (pgx.Tx, error) {
return tx, err
}
// get string builder from pool
func getSB() *strings.Builder {
return poolStringBuilder.Get().(*strings.Builder)
}
// put string builder back to pool
func putSB(sb *strings.Builder) {
sb.Reset()
poolStringBuilder.Put(sb)
// IsNotFound error check
func IsNotFound(err error) bool {
return errors.Is(err, pgx.ErrNoRows)
}