postgres

package
v0.0.0-...-514f96b Latest Latest
Warning

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

Go to latest
Published: May 29, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnableToConnect = errors.New("all attempts are exceeded. Unable to connect to instance")

Functions

This section is empty.

Types

type Client

type Client struct {
	Builder sq.StatementBuilderType
	Pool    *pgxpool.Pool
	// contains filtered or unexported fields
}

func NewClient

func NewClient(ctx context.Context, config ConnectionConfig, opts ...Option) (*Client, error)

func (*Client) Close

func (c *Client) Close()

func (*Client) Exec

func (c *Client) Exec(ctx context.Context, sql string, args ...interface{}) (pgconn.CommandTag, error)

func (*Client) Query

func (c *Client) Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)

func (*Client) QueryRow

func (c *Client) QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row

func (*Client) WithTx

func (c *Client) WithTx(ctx context.Context, txFunc func(ctx context.Context) error) error

type ConnectionConfig

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

func NewConnectionConfig

func NewConnectionConfig(host, port, dbname, username, password, sslmode string) ConnectionConfig

type Option

type Option func(*Client)

func WithConnAttempts

func WithConnAttempts(connAttempts int) Option

func WithConnTimeout

func WithConnTimeout(connTimeout time.Duration) Option

func WithMaxPoolSize

func WithMaxPoolSize(maxPoolSize int) Option

type Transactor

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

func NewTransactor

func NewTransactor(db *Client) *Transactor

func (*Transactor) WithTx

func (t *Transactor) WithTx(ctx context.Context, txFunc func(ctx context.Context) error) error

Jump to

Keyboard shortcuts

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