executor

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2025 License: Apache-2.0 Imports: 21 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBOption

type DBOption func(options *DBOptions)

func WithLogger

func WithLogger(log *logger.Adapter) DBOption

func WithTx

func WithTx(tx *sql.Tx) DBOption

type DBOptions

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

type DBSource

type DBSource interface {
	Db(ctx context.Context) (*sql.DB, error)
	Dialect(ctx context.Context) (*info.Dialect, error)
	CanBatch(table string) bool
	CanBatchGlobally() bool
}

type Executor

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

func New

func New() *Executor

func (*Executor) Exec

func (e *Executor) Exec(ctx context.Context, sess *Session, options ...DBOption) error

TODO: remove reflection TODO: customize global batch collector

func (*Executor) Execute

func (e *Executor) Execute(ctx context.Context, aView *view.View, options ...Option) error

Execute executes view dql

func (*Executor) ExecuteStmts

func (e *Executor) ExecuteStmts(ctx context.Context, dbSource DBSource, it StmtIterator, options ...DBOption) error

type Option

type Option func(session *Session) error

Option represents executor session option

func WithParameter

func WithParameter(name string, value interface{}) Option

WithParameter return parameter option

type Options

type Options []Option

Options represents options

func (Options) Apply

func (o Options) Apply(session *Session) error

apply applies session option

type Session

type Session struct {
	Session        *vsession.Session
	SessionHandler *extension.Session
	View           *view.View
	TemplateState  *expand.State
	DataUnit       *expand.DataUnit
	// contains filtered or unexported fields
}

func NewSession

func NewSession(sessionState *vsession.Session, aView *view.View) (*Session, error)

func NewSessionWithCustomHandler

func NewSessionWithCustomHandler(state *vsession.Session, aView *view.View, handler *extension.Session) (*Session, error)

func (*Session) Lookup

func (s *Session) Lookup(aView *view.View) *structology.State

type SqlBuilder

type SqlBuilder struct{}

func NewBuilder

func NewBuilder() *SqlBuilder

func (*SqlBuilder) Build

func (s *SqlBuilder) Build(aView *view.View, templateState *structology.State, session *extension.Session, dataUnit *expand2.DataUnit) (*expand2.State, []*expand2.SQLStatment, error)

type StmtIterator

type StmtIterator interface {
	HasNext() bool
	Next() interface{}
	HasAny() bool
}

type TemplateStmtIterator

type TemplateStmtIterator struct {
	DataUnit *expand.DataUnit
	Data     []*expand.SQLStatment
	// contains filtered or unexported fields
}

func NewTemplateStmtIterator

func NewTemplateStmtIterator(dataUnit *expand.DataUnit, data []*expand.SQLStatment) *TemplateStmtIterator

func (*TemplateStmtIterator) HasAny

func (t *TemplateStmtIterator) HasAny() bool

func (*TemplateStmtIterator) HasNext

func (t *TemplateStmtIterator) HasNext() bool

func (*TemplateStmtIterator) Next

func (t *TemplateStmtIterator) Next() interface{}

type Tx

type Tx interface {
	Rollback() error
	Commit() error
}

type TxTransient

type TxTransient struct{}

func (*TxTransient) Commit

func (t *TxTransient) Commit() error

func (*TxTransient) Rollback

func (t *TxTransient) Rollback() error

type ViewDBSource

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

func NewViewDBSource

func NewViewDBSource(view *view.View) *ViewDBSource

func (*ViewDBSource) CanBatch

func (v *ViewDBSource) CanBatch(table string) bool

func (*ViewDBSource) CanBatchGlobally

func (v *ViewDBSource) CanBatchGlobally() bool

func (*ViewDBSource) Db

func (v *ViewDBSource) Db(_ context.Context) (*sql.DB, error)

func (*ViewDBSource) Dialect

func (v *ViewDBSource) Dialect(ctx context.Context) (*info.Dialect, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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