cltx

package
v0.24.27 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package cltx is a small package for adding and retrieving pgx transactions from the context.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pgx added in v0.19.1

func Pgx(ctx context.Context) pgx.Tx

Pgx returns the request scoped transaction initialized in the RWTransacter or ROTransacter middleware. If this was not done the function will panic.

func Tx

func Tx[T any](ctx context.Context) T

Tx is a generic transaction reader to support various transaction types. E.g: Pgx, sql.Tx, Ent' model tx.

func WithPgx added in v0.19.1

func WithPgx(ctx context.Context, tx pgx.Tx) context.Context

WithPgx returns a context with the provided pgx tx added.

func WithTx

func WithTx[T any](ctx context.Context, tx T) context.Context

WithTx returns a context with the provided tx added.

Types

This section is empty.

Jump to

Keyboard shortcuts

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