Versions in this module Expand all Collapse all v0 v0.5.3 Dec 8, 2023 v0.5.2 Nov 26, 2023 Changes in this version + func FromContext[T any](ctx context.Context) T + func ToContext[T any](parent context.Context, value T) context.Context + type Context interface + Parent func() Context + Resources func() any + Transaction func() Transaction + func NewContext() Context + type Executor interface + Execute func(ctx context.Context, fn Func) (any, error) + ExecutorInTransaction func(ctx context.Context, fn Func, options ...Option) (any, error) + TransactionManager func() Manager + func NewExecutor(manager Manager, options ...Option) Executor + type Func func(ctx context.Context, template Template) (any, error) + type IsolationLevel int + const LevelDefault + const LevelLinearizable + const LevelReadCommitted + const LevelReadUncommitted + const LevelRepeatableRead + const LevelSerializable + const LevelSnapshot + const LevelWriteCommitted + type Manager interface + Commit func(ctx context.Context, tx Transaction) error + Connection func() *sql.DB + CreateContext func() Context + GetOrCreateTransaction func(ctx context.Context, options ...Option) (Transaction, error) + Rollback func(ctx context.Context, tx Transaction) error + func NewManager(db *sql.DB, options ...Option) Manager + type Option func(options *Options) + func WithIsolation(isolationLevel IsolationLevel) Option + func WithPropagation(propagation Propagation) Option + func WithReadOnly(readOnly bool) Option + func WithTimeout(timeout time.Duration) Option + type Options struct + IsolationLevel IsolationLevel + Propagation Propagation + ReadOnly bool + Timeout time.Duration + func DefaultOptions() *Options + func NewOptions(opts ...Option) *Options + func WithOptions(opts *Options, options ...Option) *Options + type Propagation int + const PropagationMandatory + const PropagationNested + const PropagationNever + const PropagationNotSupported + const PropagationRequired + const PropagationRequiredNew + const PropagationSupports + type Template interface + Exec func(query string, args ...any) (sql.Result, error) + ExecContext func(ctx context.Context, query string, args ...any) (sql.Result, error) + Prepare func(query string) (*sql.Stmt, error) + PrepareContext func(ctx context.Context, query string) (*sql.Stmt, error) + Query func(query string, args ...any) (*sql.Rows, error) + QueryContext func(ctx context.Context, query string, args ...any) (*sql.Rows, error) + QueryRow func(query string, args ...any) *sql.Row + QueryRowContext func(ctx context.Context, query string, args ...any) *sql.Row + type Transaction interface + IsCompleted func() bool + IsNew func() bool + IsReadOnly func() bool + IsRollbackOnly func() bool + MarkAsCompleted func() + MarkAsRollbackOnly func() + Tx func() *sql.Tx + func New(tx *sql.Tx, newTransaction bool, readOnly bool) Transaction