pgxv5

package
v0.0.0-...-4b0a3d7 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAccessMode

WithAccessMode - set transaction AccessMode

func WithDeferrableMode

WithDeferrableMode - set transaction DeferrableMode

func WithIsoLevel

WithIsoLevel - set transaction IsoLevel

Types

type PgxCommonAPI

type PgxCommonAPI interface {
	QueryRow(ctx context.Context, sql string, args ...interface{}) pgx.Row
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
	Exec(ctx context.Context, sql string, arguments ...interface{}) (pgconn.CommandTag, error)
}

PgxCommonAPI - pgx common API (like database/sql)

type PgxExtendedAPI

type PgxExtendedAPI interface {
	SendBatch(ctx context.Context, b *pgx.Batch) pgx.BatchResults
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

PgxExtendedAPI - pgx special API

type QueryEngine

type QueryEngine interface {
	PgxCommonAPI
	PgxExtendedAPI
}

QueryEngine is a common database query interface.

type QueryEngineProvider

type QueryEngineProvider interface {
	// returns pgx QueryEngine API
	GetQueryEngine(ctx context.Context) QueryEngine
}

QueryEngineProvider - something that gives us QueryEngine

type TransactionManager

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

TransactionManager - transaction manager: allows you to perform the functions of different repositories included in one database within a transaction.

func New

func New(pool *pgxpool.Pool) *TransactionManager

New returns transaction_manager.TransactionManager interface implementation

func (*TransactionManager) GetQueryEngine

func (m *TransactionManager) GetQueryEngine(ctx context.Context) QueryEngine

GetQueryEngine provides QueryEngine

func (*TransactionManager) RunTransaction

func (m *TransactionManager) RunTransaction(
	ctx context.Context,
	fn func(txCtx context.Context) error,
	opts ...transaction_manager.TransactionOption,
) error

RunReadCommitted - execute function fn in runTransaction

Jump to

Keyboard shortcuts

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