postgres

package
v0.0.0-...-f90eb3b Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package postgres implements postgres connection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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 PgxPool

type PgxPool interface {
	Close()
	Acquire(ctx context.Context) (*pgxpool.Conn, error)
	Exec(ctx context.Context, sql string, arguments ...any) (pgconn.CommandTag, error)
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	Begin(ctx context.Context) (pgx.Tx, error)
	BeginTx(ctx context.Context, txOptions pgx.TxOptions) (pgx.Tx, error)
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
	Ping(ctx context.Context) error
}

type Postgres

type Postgres struct {
	Builder squirrel.StatementBuilderType
	Pool    PgxPool
	// contains filtered or unexported fields
}

Postgres -.

func New

func New(url string, opts ...Option) (*Postgres, error)

New -.

func (*Postgres) Close

func (p *Postgres) Close()

Close -.

Jump to

Keyboard shortcuts

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