session

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func RegisterCatalog added in v0.0.3

func RegisterCatalog(database string, catalog builder.Catalog)

Types

type Adaptor added in v0.0.3

type Adaptor = adaptor.Adaptor

type Database added in v0.0.3

type Database struct {
	Endpoint datatypex.Endpoint
	Readonly datatypex.Endpoint

	AutoMigration   bool
	DryRun          bool
	CreateTableOnly bool
	// contains filtered or unexported fields
}

func (*Database) ApplyCatalog added in v0.0.3

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

func (*Database) Catalog added in v0.0.3

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

func (*Database) Init added in v0.0.3

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

func (*Database) Name added in v0.0.3

func (d *Database) Name() string

func (*Database) Run added in v0.0.3

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

func (*Database) Session added in v0.0.3

func (d *Database) Session() Session

func (*Database) SetDefault added in v0.0.3

func (d *Database) SetDefault()

type OptionFunc added in v0.0.3

type OptionFunc func(*option)

func ReadOnly added in v0.0.3

func ReadOnly() OptionFunc

type Session added in v0.0.3

type Session interface {
	// Database physically endpoint
	Database() string
	// Schema logically
	Schema() 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 added in v0.0.3

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

func FromContext added in v0.0.3

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

func New added in v0.0.3

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

func NewRO added in v0.0.3

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