postgres

package
v0.0.0-...-ea2d26f Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package repo implements repo connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Batch

type Batch struct {
	sync.Mutex
	*pgx.Batch
}

func (*Batch) Len

func (b *Batch) Len() int

func (*Batch) Queue

func (b *Batch) Queue(sql string, args ...any) *pgx.QueuedQuery

type Option

type Option func(*Postgres)

Option -.

func ConnAttempts

func ConnAttempts(attempts int) Option

ConnAttempts -.

func ConnTimeout

func ConnTimeout(timeout time.Duration) Option

ConnTimeout -.

func MaxPoolSize

func MaxPoolSize(size int) Option

MaxPoolSize -.

type Postgres

type Postgres struct {
	Pool *pgxpool.Pool
	// contains filtered or unexported fields
}

Postgres -.

func New

func New(ctx context.Context, logger *adapter.Logger, url string, opts ...Option) (*Postgres, error)

New -.

func (*Postgres) Begin

func (p *Postgres) Begin(ctx context.Context) (pgx.Tx, error)

func (*Postgres) Close

func (p *Postgres) Close()

Close -.

func (*Postgres) IsNoRows

func (p *Postgres) IsNoRows(err error) bool

func (*Postgres) NewBatch

func (p *Postgres) NewBatch() *Batch

func (*Postgres) ToPgErr

func (p *Postgres) ToPgErr(err error) error

type Tx

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

func (*Tx) Begin

func (ct *Tx) Begin(ctx context.Context) (pgx.Tx, error)

func (*Tx) Commit

func (ct *Tx) Commit(ctx context.Context) error

func (*Tx) Conn

func (ct *Tx) Conn() *pgx.Conn

func (*Tx) CopyFrom

func (ct *Tx) CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)

func (*Tx) Exec

func (ct *Tx) Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)

func (*Tx) LargeObjects

func (ct *Tx) LargeObjects() pgx.LargeObjects

func (*Tx) Prepare

func (ct *Tx) Prepare(ctx context.Context, name, sql string) (*pgconn.StatementDescription, error)

func (*Tx) Query

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

func (*Tx) QueryRow

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

func (*Tx) Rollback

func (ct *Tx) Rollback(ctx context.Context) error

func (*Tx) SendBatch

func (ct *Tx) SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults

Jump to

Keyboard shortcuts

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