database

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

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

func New

func New(ctx context.Context, host, port, user, password, db string, opts ...Option) *Db

func (*Db) BeginTx

func (d *Db) BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)

func (*Db) Close

func (d *Db) Close()

func (*Db) Exec

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

func (*Db) Ping

func (d *Db) Ping(ctx context.Context) error

func (*Db) Query

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

func (*Db) QueryRow

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

type Option

type Option func(db *Db)

func WithConnectionTimeout

func WithConnectionTimeout(timeout time.Duration) Option

func WithHealthCheckPeriod

func WithHealthCheckPeriod(period time.Duration) Option

func WithLogLevel

func WithLogLevel(loglevel pgx.LogLevel) Option

func WithLogger

func WithLogger(logger pgx.Logger) Option

func WithMaxConnections

func WithMaxConnections(maxConnections int32) Option

func WithTLSConfig

func WithTLSConfig(tlsConf *tls.Config) Option

Jump to

Keyboard shortcuts

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