Use errors instead of golang.org/x/xerrors
This commit is contained in:
+7
-7
@@ -2,6 +2,7 @@ package pgxpool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"runtime"
|
||||
"strconv"
|
||||
"sync"
|
||||
@@ -10,7 +11,6 @@ import (
|
||||
"github.com/jackc/pgconn"
|
||||
"github.com/jackc/pgx/v4"
|
||||
"github.com/jackc/puddle"
|
||||
errors "golang.org/x/xerrors"
|
||||
)
|
||||
|
||||
var defaultMaxConns = int32(4)
|
||||
@@ -266,10 +266,10 @@ func ParseConfig(connString string) (*Config, error) {
|
||||
delete(connConfig.Config.RuntimeParams, "pool_max_conns")
|
||||
n, err := strconv.ParseInt(s, 10, 32)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("cannot parse pool_max_conns: %w", err)
|
||||
return nil, fmt.Errorf("cannot parse pool_max_conns: %w", err)
|
||||
}
|
||||
if n < 1 {
|
||||
return nil, errors.Errorf("pool_max_conns too small: %d", n)
|
||||
return nil, fmt.Errorf("pool_max_conns too small: %d", n)
|
||||
}
|
||||
config.MaxConns = int32(n)
|
||||
} else {
|
||||
@@ -283,7 +283,7 @@ func ParseConfig(connString string) (*Config, error) {
|
||||
delete(connConfig.Config.RuntimeParams, "pool_min_conns")
|
||||
n, err := strconv.ParseInt(s, 10, 32)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("cannot parse pool_min_conns: %w", err)
|
||||
return nil, fmt.Errorf("cannot parse pool_min_conns: %w", err)
|
||||
}
|
||||
config.MinConns = int32(n)
|
||||
} else {
|
||||
@@ -294,7 +294,7 @@ func ParseConfig(connString string) (*Config, error) {
|
||||
delete(connConfig.Config.RuntimeParams, "pool_max_conn_lifetime")
|
||||
d, err := time.ParseDuration(s)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("invalid pool_max_conn_lifetime: %w", err)
|
||||
return nil, fmt.Errorf("invalid pool_max_conn_lifetime: %w", err)
|
||||
}
|
||||
config.MaxConnLifetime = d
|
||||
} else {
|
||||
@@ -305,7 +305,7 @@ func ParseConfig(connString string) (*Config, error) {
|
||||
delete(connConfig.Config.RuntimeParams, "pool_max_conn_idle_time")
|
||||
d, err := time.ParseDuration(s)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("invalid pool_max_conn_idle_time: %w", err)
|
||||
return nil, fmt.Errorf("invalid pool_max_conn_idle_time: %w", err)
|
||||
}
|
||||
config.MaxConnIdleTime = d
|
||||
} else {
|
||||
@@ -316,7 +316,7 @@ func ParseConfig(connString string) (*Config, error) {
|
||||
delete(connConfig.Config.RuntimeParams, "pool_health_check_period")
|
||||
d, err := time.ParseDuration(s)
|
||||
if err != nil {
|
||||
return nil, errors.Errorf("invalid pool_health_check_period: %w", err)
|
||||
return nil, fmt.Errorf("invalid pool_health_check_period: %w", err)
|
||||
}
|
||||
config.HealthCheckPeriod = d
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user