dbv5

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(ctx context.Context, pCfg *postgresconfig5.PostgresConfig,
	afterConnect func(context.Context, *pgx.Conn) error, log *logger.ZapLogger,
) (conn *pgx.Conn, err error)

Connect connect to database in pgx v4

func ConnectPool

func ConnectPool(ctx context.Context, pCfg *postgresconfig5.PostgresConfig,
	afterConnect func(context.Context, *pgx.Conn) error, log *logger.ZapLogger,
) (*pgxpool.Pool, error)

ConnectPool connect pool to postgres in pgx v4

Types

type AfterConnectFunc

type AfterConnectFunc func(ctx context.Context, conn *pgx.Conn) error

type AfterConnectList

type AfterConnectList []AfterConnectFunc

func NewAfterConnectList

func NewAfterConnectList(opts ...AfterConnectFunc) AfterConnectList

func (AfterConnectList) AfterConnect

func (c AfterConnectList) AfterConnect(ctx context.Context, conn *pgx.Conn) error

type DbPool

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

DbPool dbo

func (*DbPool) Acquire

func (s *DbPool) Acquire(ctx context.Context) (*pgxpool.Conn, error)

Acquire get connect

func (*DbPool) Check

func (s *DbPool) Check(ctx context.Context, tid int64) (bool, error)

Check check pg exist

func (*DbPool) Close

func (s *DbPool) Close()

Close pgx connection

func (*DbPool) GetPool

func (s *DbPool) GetPool() *pgxpool.Pool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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