session

package
v0.1.15 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MaskedPassword = "--------"

Variables

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

Functions

func Carry added in v0.0.4

func Carry(session Session) contextx.Carrier

Carry returns context carrier

func With added in v0.0.4

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

With injects Session

Types

type Adaptor added in v0.0.3

type Adaptor = adaptor.Adaptor

type Database added in v0.0.3

type Database struct {
	Endpoint Endpoint
	Readonly 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)

ApplyCatalog should do before endpoint initialization

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 Endpoint added in v0.1.13

type Endpoint struct {
	Scheme   string
	Host     string
	Port     uint16
	Base     string
	Username string
	Password Password
	Param    url.Values
}

func ParseEndpoint added in v0.1.13

func ParseEndpoint(text string) (*Endpoint, error)

func (Endpoint) Hostname added in v0.1.13

func (e Endpoint) Hostname() string

func (Endpoint) IsZero added in v0.1.13

func (e Endpoint) IsZero() bool

func (Endpoint) MarshalText added in v0.1.13

func (e Endpoint) MarshalText() ([]byte, error)

func (Endpoint) SecurityString added in v0.1.13

func (e Endpoint) SecurityString() string

func (Endpoint) String added in v0.1.13

func (e Endpoint) String() string

func (*Endpoint) UnmarshalText added in v0.1.13

func (e *Endpoint) UnmarshalText(text []byte) error

type OptionFunc added in v0.0.3

type OptionFunc func(*option)

func ReadOnly added in v0.0.3

func ReadOnly() OptionFunc

type Password added in v0.1.13

type Password string

func (Password) SecurityString added in v0.1.13

func (p Password) SecurityString() string

func (Password) String added in v0.1.13

func (p Password) String() string

type Session added in v0.0.3

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 added in v0.0.3

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

For retrieves Session by session name or table

func From added in v0.0.4

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

From retrieve Session from ctx by Session.Name

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