settings

package
v2.0.0-rc7 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2024 License: MIT Imports: 2 Imported by: 1

Documentation

Overview

Package settings implements trm.Settings.

Index

Constants

This section is empty.

Variables

View Source
var DefaultCtxKey = ctxKey{} //nolint:gochecknoglobals

DefaultCtxKey is a default key to store Transaction.

Functions

This section is empty.

Types

type Opt

type Opt func(*Settings) error

Opt is type to set Settings' properties.

func WithCancelable

func WithCancelable(t bool) Opt

WithCancelable sets up possibility to cancel child goroutines when parent trm.Transaction was canceled.

func WithCtxKey

func WithCtxKey(key trm.CtxKey) Opt

WithCtxKey sets up trm.CtxKey for the trm.Settings.

func WithPropagation

func WithPropagation(p trm.Propagation) Opt

WithPropagation sets up a trm.Propagation for the trm.Settings.

func WithTimeout

func WithTimeout(t time.Duration) Opt

WithTimeout sets up a timeout for the trm.trm.

type Settings

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

Settings is an implementation of trm.Settings.

func Must

func Must(oo ...Opt) Settings

Must returns Settings if err is nil and panics otherwise.

func New

func New(oo ...Opt) (Settings, error)

New creates trm.Settings.

func (Settings) Cancelable

func (s Settings) Cancelable() bool

Cancelable defines that parent trm.Transaction can cancel children transactions.

func (Settings) CancelableOrNil

func (s Settings) CancelableOrNil() *bool

CancelableOrNil returns Cancelable or nil.

func (Settings) CtxKey

func (s Settings) CtxKey() trm.CtxKey

CtxKey returns key(trm.CtxKey) to get trm.Transaction from context.Context.

func (Settings) CtxKeyOrNil

func (s Settings) CtxKeyOrNil() *trm.CtxKey

CtxKeyOrNil returns key(*trm.CtxKey) or nil.

func (Settings) EnrichBy

func (s Settings) EnrichBy(external trm.Settings) (res trm.Settings)

EnrichBy fills nil properties from external Settings.

func (Settings) Propagation

func (s Settings) Propagation() trm.Propagation

Propagation returns trm.Propagation.

func (Settings) PropagationOrNil

func (s Settings) PropagationOrNil() *trm.Propagation

PropagationOrNil returns trm.Propagation or nil.

func (Settings) SetCancelable

func (s Settings) SetCancelable(t *bool) trm.Settings

SetCancelable sets Cancelable(*bool).

func (Settings) SetCtxKey

func (s Settings) SetCtxKey(key *trm.CtxKey) trm.Settings

SetCtxKey sets key(*trm.CtxKey) to store trm.Transaction in context.Context.

func (Settings) SetPropagation

func (s Settings) SetPropagation(p *trm.Propagation) trm.Settings

SetPropagation sets *trm.Propagation.

func (Settings) SetTimeout

func (s Settings) SetTimeout(t *time.Duration) trm.Settings

SetTimeout sets *time.Duration for trm.Transaction.

func (Settings) TimeoutOrNil

func (s Settings) TimeoutOrNil() *time.Duration

TimeoutOrNil returns time.Duration of the trm.Transaction.

Jump to

Keyboard shortcuts

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