session

package
v0.3.1-rc2 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2026 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CarryModel added in v0.2.9

func CarryModel(m builder.Model, s Session) contextx.Carrier

func CarrySchemaModel added in v0.2.9

func CarrySchemaModel(m builder.Model, s Session) contextx.Carrier

func ExecutorFor added in v0.2.9

func ExecutorFor(ctx context.Context, m any) (adaptor.ExecutorX, bool)

func InTx added in v0.2.9

func InTx(ctx context.Context) bool

func MustExecutorFor added in v0.2.9

func MustExecutorFor(ctx context.Context, m any) adaptor.ExecutorX

func Register added in v0.2.2

func Register(cats ...builder.Catalog)

func With added in v0.0.4

func With(ctx context.Context, s Session) context.Context

func WithModel added in v0.2.9

func WithModel(ctx context.Context, m builder.Model, s Session) context.Context

func WithSchemaModel added in v0.2.9

func WithSchemaModel(ctx context.Context, m builder.Model, s Session) context.Context

Types

type AdaptorOption added in v0.1.18

type AdaptorOption struct {
	ReadOnly bool
}

type AdaptorOptionApplier added in v0.2.1

type AdaptorOptionApplier func(*AdaptorOption)

func ReadOnly added in v0.0.3

func ReadOnly() AdaptorOptionApplier

type Session added in v0.0.3

type Session interface {
	// Name logic session name
	Name() string
	// T picks table from session
	T(any) builder.Table
	// Tx exec query
	Tx(context.Context, func(context.Context) error) error
	// Adaptor returns session adaptor
	Adaptor(...AdaptorOptionApplier) adaptor.Adaptor
}

Session defines logic session interface

func For added in v0.0.3

func For(ctx context.Context, m any) (Session, bool)

For retrieves Session by session name or table

func From added in v0.0.4

func From(ctx context.Context, name string) (Session, bool)

func FromByModel added in v0.2.9

func FromByModel(ctx context.Context, m builder.Model) (Session, bool)

func Must added in v0.2.1

func Must(ctx context.Context, name string) Session

func MustByModel added in v0.2.9

func MustByModel(ctx context.Context, m builder.Model) Session

func MustFor added in v0.2.1

func MustFor(ctx context.Context, m any) Session

func New added in v0.0.3

func New(a adaptor.Adaptor, name string) Session

func NewReadonly added in v0.2.1

func NewReadonly(rw adaptor.Adaptor, ro adaptor.Adaptor, name string) Session

Jump to

Keyboard shortcuts

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