pgx

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Instance added in v0.4.4

type Instance interface {
	Ping(ctx context.Context) error
	Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
	QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
	// contains filtered or unexported methods
}

Instance is an abstraction of pgx API, to allow to use pgx.Conn or pgxpool.Pool.

type Store

type Store[T any] struct {
	*postgres.Storer[T]
}

Store is the instance to store and retrieve the messages in PostgreSQL database.

func Open

func Open[T any](ctx context.Context, connStr string, opts ...postgres.Option) (*Store[T], error)

Open returns a pgx source connected to database connection string with config.

func WithInstance added in v0.4.4

func WithInstance[T any](ctx context.Context, i Instance, opts ...postgres.Option) (*Store[T], error)

WithInstance returns Store source initialised with the given connection pool instance and config.

func (*Store[T]) Store

func (s *Store[T]) Store(ctx context.Context, tx pgx.Tx, msgs ...T) error

Store saves message in postgres database with the given transaction.

Jump to

Keyboard shortcuts

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