txn_pgx

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Execute added in v0.0.8

func Execute[Stmt StmtHolder, D Doer[Stmt]](
	ctx context.Context, mod Module[Stmt], doer D,
	fn txn.DoFunc[Options, Beginner, D], setters ...txn.DoerFieldSetter,
) (D, error)

func ExecuteOnce added in v0.0.8

func ExecuteOnce[
	D txn.Doer[Options, Beginner],
](ctx context.Context, beginner Beginner, do D, fn txn.DoFunc[Options, Beginner, D]) error

ExecuteOnce executes a pgx transaction.

func ExecuteRo added in v0.0.8

func ExecuteRo[Stmt StmtHolder, D Doer[Stmt]](
	ctx context.Context, mod Module[Stmt], do D,
	fn txn.DoFunc[Options, Beginner, D], setters ...txn.DoerFieldSetter,
) (D, error)

func ExecuteRw added in v0.0.8

func ExecuteRw[Stmt StmtHolder, D Doer[Stmt]](
	ctx context.Context, mod Module[Stmt], do D,
	fn txn.DoFunc[Options, Beginner, D], setters ...txn.DoerFieldSetter,
) (D, error)

func Ping added in v0.0.8

func Ping(beginner Beginner, limit int, count txn.PingCount) (int, error)

Ping performs a ping operation.

Types

type Beginner added in v0.0.8

type Beginner = *pgxpool.Pool

type Doer added in v0.0.8

type Doer[Stmt any] interface {
	txn.Doer[Options, Beginner]
	ReadOnlySetters(title string) []txn.DoerFieldSetter
	ReadWriteSetters(title string) []txn.DoerFieldSetter
	Stmt() Stmt
	SetStmt(Stmt)
}

Doer defines the interface for PGX transaction operations.

type DoerBase added in v0.0.8

type DoerBase[Stmt any] struct {
	txn.DoerBase[Options, Beginner]
	// contains filtered or unexported fields
}

DoerBase provides a base implementation for the Doer interface.

func (*DoerBase[_]) ReadOnlySetters added in v0.0.8

func (do *DoerBase[_]) ReadOnlySetters(title string) []txn.DoerFieldSetter

func (*DoerBase[_]) ReadWriteSetters added in v0.0.8

func (do *DoerBase[_]) ReadWriteSetters(title string) []txn.DoerFieldSetter

func (*DoerBase[S]) SetStmt added in v0.0.8

func (do *DoerBase[S]) SetStmt(s S)

SetStmt sets the statement.

func (*DoerBase[S]) Stmt added in v0.0.8

func (do *DoerBase[S]) Stmt() S

Stmt returns the statement.

type Module added in v0.0.8

type Module[Stmt StmtHolder] interface {
	Beginner() Beginner
}

type ModuleBase added in v0.0.8

type ModuleBase[Stmt StmtHolder] struct {
	// contains filtered or unexported fields
}

func (*ModuleBase[_]) Beginner added in v0.0.8

func (b *ModuleBase[_]) Beginner() Beginner

func (*ModuleBase[_]) Init added in v0.0.8

func (b *ModuleBase[_]) Init(beginner Beginner)

type Options added in v0.0.8

type Options = *pgx.TxOptions

type RawTx added in v0.0.10

type RawTx = pgx.Tx

type RawTxn added in v0.0.10

type RawTxn interface {
	txn.Txn
	Raw() RawTx
}

func BeginTxn added in v0.0.8

func BeginTxn(ctx context.Context, beginner Beginner, opt Options) (RawTxn, error)

BeginTxn begins a pgx transaction.

type StmtHolder added in v0.0.8

type StmtHolder = any

Jump to

Keyboard shortcuts

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