session

package
v0.1.25 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Scan = scanner.Scan
	Open = adaptor.Open
)

Functions

func Carry

func Carry(session Session) contextx.Carrier

Carry returns context carrier

func With

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

With injects Session

Types

type Adaptor

type Adaptor = adaptor.Adaptor

type AdaptorOption

type AdaptorOption struct {
	ReadOnly bool
}

type Endpoint

type Endpoint struct {
	types.Endpoint[EndpointOption]
	Readonly types.Endpoint[EndpointOption]
	// contains filtered or unexported fields
}

func (*Endpoint) ApplyCatalog

func (d *Endpoint) ApplyCatalog(name string, catalogs ...builder.Catalog)

ApplyCatalog should do before endpoint initialization

func (*Endpoint) Catalog

func (d *Endpoint) Catalog() builder.Catalog

func (*Endpoint) Close

func (d *Endpoint) Close() error

func (*Endpoint) Init

func (d *Endpoint) Init(ctx context.Context) error

func (*Endpoint) LivenessCheck

func (d *Endpoint) LivenessCheck(ctx context.Context) (v types.LivenessData)

func (*Endpoint) Name

func (d *Endpoint) Name() string

func (*Endpoint) Run

func (d *Endpoint) Run(ctx context.Context) error

func (*Endpoint) Session

func (d *Endpoint) Session() Session

type EndpointOption

type EndpointOption struct {
	AutoMigration   bool `url:"-"`
	DryRun          bool `url:"-"`
	CreateTableOnly bool `url:"-"`
	MultiStatements bool
}

func (*EndpointOption) SetDefault

func (o *EndpointOption) SetDefault()

type OptionFunc

type OptionFunc func(*AdaptorOption)

func ReadOnly

func ReadOnly() OptionFunc

type Session

type Session interface {
	// Database physically endpoint
	Database() string
	// Schema logically
	Schema() string
	// Name returns 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(...OptionFunc) adaptor.Adaptor
}

func For

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

For retrieves Session by session name or table

func From

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

From retrieve Session from ctx by Session.Name

func New

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

func NewRO

func NewRO(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