pgsqlclient

package
v0.0.0-...-a769874 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 4, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrOption = errors.New("pgsql client invalid option")

Functions

func CreateDSN

func CreateDSN(opts PoolOptions) (*tls.Config, string, error)

func NewDBEngine

func NewDBEngine(pool *pgxpool.Pool, env string, log logger.Logger) pgsqlstorage.DBEngine

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client - postgres connection pool.

func NewPool

func NewPool(ctx context.Context, opts PoolOptions) (*Client, error)

NewPool - returns new Client (connection pool for postgres).

func (*Client) Close

func (c *Client) Close() error

func (*Client) DB

func (c *Client) DB() pgsql.DBEngine

func (*Client) Pool

func (c *Client) Pool() *pgxpool.Pool

type OptPoolOptionsSetter

type OptPoolOptionsSetter func(o *PoolOptions)

func WithCheck

func WithCheck(check bool) OptPoolOptionsSetter

func WithDebug

func WithDebug(debug bool) OptPoolOptionsSetter

func WithEnvironment

func WithEnvironment(env string) OptPoolOptionsSetter

func WithLogger

func WithLogger(logger logger.Logger) OptPoolOptionsSetter

func WithMaxConnIdleTime

func WithMaxConnIdleTime(maxConnIdleTime time.Duration) OptPoolOptionsSetter

func WithMaxConnLifeTime

func WithMaxConnLifeTime(maxConnLifeTime time.Duration) OptPoolOptionsSetter

func WithMaxConnectionsCount

func WithMaxConnectionsCount(maxConnections int32) OptPoolOptionsSetter

func WithMinConnectionsCount

func WithMinConnectionsCount(minConnections int32) OptPoolOptionsSetter

func WithSSLMode

func WithSSLMode(sslMode string) OptPoolOptionsSetter

func WithTLSConfig

func WithTLSConfig(cfg *tls.Config) OptPoolOptionsSetter

func WithTLSPath

func WithTLSPath(cert string, key string) OptPoolOptionsSetter

type PoolOptions

type PoolOptions struct {
	// contains filtered or unexported fields
}

func NewOptions

func NewOptions(
	address string,
	username string,
	password string,
	database string,
	options ...OptPoolOptionsSetter,
) PoolOptions

func (*PoolOptions) Validate

func (o *PoolOptions) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL