mirror of https://github.com/jackc/pgx.git
Go 1.19 go fmt
parent
7ad36f386d
commit
f3e04b28cc
14
conn.go
14
conn.go
|
@ -116,14 +116,14 @@ func ConnectConfig(ctx context.Context, connConfig *ConnConfig) (*Conn, error) {
|
||||||
// ParseConfig creates a ConnConfig from a connection string. ParseConfig handles all options that pgconn.ParseConfig
|
// ParseConfig creates a ConnConfig from a connection string. ParseConfig handles all options that pgconn.ParseConfig
|
||||||
// does. In addition, it accepts the following options:
|
// does. In addition, it accepts the following options:
|
||||||
//
|
//
|
||||||
// statement_cache_capacity
|
// statement_cache_capacity
|
||||||
// The maximum size of the automatic statement cache. Set to 0 to disable automatic statement caching. Default: 512.
|
// The maximum size of the automatic statement cache. Set to 0 to disable automatic statement caching. Default: 512.
|
||||||
//
|
//
|
||||||
// statement_cache_mode
|
// statement_cache_mode
|
||||||
// Possible values: "prepare" and "describe". "prepare" will create prepared statements on the PostgreSQL server.
|
// Possible values: "prepare" and "describe". "prepare" will create prepared statements on the PostgreSQL server.
|
||||||
// "describe" will use the anonymous prepared statement to describe a statement without creating a statement on the
|
// "describe" will use the anonymous prepared statement to describe a statement without creating a statement on the
|
||||||
// server. "describe" is primarily useful when the environment does not allow prepared statements such as when
|
// server. "describe" is primarily useful when the environment does not allow prepared statements such as when
|
||||||
// running a connection pooler like PgBouncer. Default: "prepare"
|
// running a connection pooler like PgBouncer. Default: "prepare"
|
||||||
//
|
//
|
||||||
// prefer_simple_protocol
|
// prefer_simple_protocol
|
||||||
// Possible values: "true" and "false". Use the simple protocol instead of extended protocol. Default: false
|
// Possible values: "true" and "false". Use the simple protocol instead of extended protocol. Default: false
|
||||||
|
|
|
@ -56,10 +56,10 @@ func (o *LargeObjects) Unlink(ctx context.Context, oid uint32) error {
|
||||||
// A LargeObject is a large object stored on the server. It is only valid within the transaction that it was initialized
|
// A LargeObject is a large object stored on the server. It is only valid within the transaction that it was initialized
|
||||||
// in. It uses the context it was initialized with for all operations. It implements these interfaces:
|
// in. It uses the context it was initialized with for all operations. It implements these interfaces:
|
||||||
//
|
//
|
||||||
// io.Writer
|
// io.Writer
|
||||||
// io.Reader
|
// io.Reader
|
||||||
// io.Seeker
|
// io.Seeker
|
||||||
// io.Closer
|
// io.Closer
|
||||||
type LargeObject struct {
|
type LargeObject struct {
|
||||||
ctx context.Context
|
ctx context.Context
|
||||||
tx Tx
|
tx Tx
|
||||||
|
|
|
@ -58,6 +58,7 @@ func (f LoggerFunc) Log(ctx context.Context, level LogLevel, msg string, data ma
|
||||||
// LogLevelFromString converts log level string to constant
|
// LogLevelFromString converts log level string to constant
|
||||||
//
|
//
|
||||||
// Valid levels:
|
// Valid levels:
|
||||||
|
//
|
||||||
// trace
|
// trace
|
||||||
// debug
|
// debug
|
||||||
// info
|
// info
|
||||||
|
|
|
@ -213,6 +213,7 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
|
||||||
// cancellation
|
// cancellation
|
||||||
// see https://github.com/jackc/pgx/issues/1259
|
// see https://github.com/jackc/pgx/issues/1259
|
||||||
ctx = detachedCtx{ctx}
|
ctx = detachedCtx{ctx}
|
||||||
|
|
||||||
connConfig := p.config.ConnConfig
|
connConfig := p.config.ConnConfig
|
||||||
|
|
||||||
if p.beforeConnect != nil {
|
if p.beforeConnect != nil {
|
||||||
|
@ -290,11 +291,11 @@ func ConnectConfig(ctx context.Context, config *Config) (*Pool, error) {
|
||||||
//
|
//
|
||||||
// See Config for definitions of these arguments.
|
// See Config for definitions of these arguments.
|
||||||
//
|
//
|
||||||
// # Example DSN
|
// # Example DSN
|
||||||
// user=jack password=secret host=pg.example.com port=5432 dbname=mydb sslmode=verify-ca pool_max_conns=10
|
// user=jack password=secret host=pg.example.com port=5432 dbname=mydb sslmode=verify-ca pool_max_conns=10
|
||||||
//
|
//
|
||||||
// # Example URL
|
// # Example URL
|
||||||
// postgres://jack:secret@pg.example.com:5432/mydb?sslmode=verify-ca&pool_max_conns=10
|
// postgres://jack:secret@pg.example.com:5432/mydb?sslmode=verify-ca&pool_max_conns=10
|
||||||
func ParseConfig(connString string) (*Config, error) {
|
func ParseConfig(connString string) (*Config, error) {
|
||||||
connConfig, err := pgx.ParseConfig(connString)
|
connConfig, err := pgx.ParseConfig(connString)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue