pgy

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection struct {
	Con                *pgxpool.Pool
	TransactionManager *TransactionManager
}

func NewConnection

func NewConnection(dsn string) (*Connection, error)

func (*Connection) Exec

func (c *Connection) Exec(ctx context.Context, sql string, args ...any) error

func (*Connection) ExecM

func (c *Connection) ExecM(ctx context.Context, sql string, argMap map[string]any) error

func (*Connection) GetTransactionManager

func (c *Connection) GetTransactionManager() TransactionManagerI

func (*Connection) Query

func (c *Connection) Query(ctx context.Context, sql string, args ...any) (RowsI, error)

func (*Connection) QueryM

func (c *Connection) QueryM(ctx context.Context, sql string, argMap map[string]any) (RowsI, error)

func (*Connection) QueryRow

func (c *Connection) QueryRow(ctx context.Context, sql string, args ...any) RowI

func (*Connection) QueryRowM

func (c *Connection) QueryRowM(ctx context.Context, sql string, argMap map[string]any) RowI

type ConnectionI

type ConnectionI interface {
	Exec(ctx context.Context, sql string, args ...any) error
	Query(ctx context.Context, sql string, args ...any) (RowsI, error)
	QueryRow(ctx context.Context, sql string, args ...any) RowI
	ExecM(ctx context.Context, sql string, argMap map[string]any) error
	QueryM(ctx context.Context, sql string, argMap map[string]any) (RowsI, error)
	QueryRowM(ctx context.Context, sql string, argMap map[string]any) RowI
	GetTransactionManager() TransactionManagerI
}

type RowI

type RowI interface {
	Scan(dest ...any) error
}

type RowsI

type RowsI interface {
	Close()
	Err() error
	Next() bool
	Scan(dest ...any) error
}

type TransactionManager

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

func NewTransactionManager

func NewTransactionManager(connection *pgxpool.Pool) *TransactionManager

func (*TransactionManager) RenewContextTx

func (t *TransactionManager) RenewContextTx(ctx context.Context) error

func (*TransactionManager) TxAddAsyncCallback

func (t *TransactionManager) TxAddAsyncCallback(ctx context.Context, f func())

func (*TransactionManager) TxFn

type TransactionManagerI

type TransactionManagerI interface {
	TxFn(ctx context.Context, f func(context.Context) error) error
	RenewContextTx(ctx context.Context) error
	TxAddAsyncCallback(ctx context.Context, f func())
}

type Tx

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

Jump to

Keyboard shortcuts

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