db

package
v0.0.0-...-a84dc14 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	DSN             string
	MaxConns        int32
	MinConns        int32
	MaxConnLifetime time.Duration
	MaxConnIdleTime time.Duration
}

func DefaultConfig

func DefaultConfig() Config

type Db

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

func New

func New(c Config, l *zap.Logger) (*Db, error)

func (*Db) Check

func (db *Db) Check(ctx context.Context) error

func (*Db) Grace

func (db *Db) Grace(_ context.Context) error

func (*Db) Name

func (db *Db) Name() string

func (*Db) Start

func (db *Db) Start(ctx context.Context) error

type TxFunc

type TxFunc[T any] func(ctx context.Context, q T) error

type TxManager

type TxManager[T any] struct {
	Begin func(ctx context.Context) (
		T,
		func(ctx context.Context) error,
		func(ctx context.Context) error,
		error,
	)
}

func (*TxManager[T]) Do

func (m *TxManager[T]) Do(ctx context.Context, fn TxFunc[T]) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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