executor

package
v0.9.8 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatcherRegistry

type BatcherRegistry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewBatcherRegistry

func NewBatcherRegistry() *BatcherRegistry

func (*BatcherRegistry) GetBatcher

func (r *BatcherRegistry) GetBatcher(tableName string, rType reflect.Type, db *sql.DB, config *batcher.Config) (*batcher.Service, error)

type BatcherTypeRegistry

type BatcherTypeRegistry struct {
	sync.Mutex
	// contains filtered or unexported fields
}

func NewBatcherTypeRegistry

func NewBatcherTypeRegistry() *BatcherTypeRegistry

func (*BatcherTypeRegistry) GetBatcher

func (r *BatcherTypeRegistry) GetBatcher(tableName string, rType reflect.Type, db *sql.DB, config *batcher.Config) (*batcher.Service, error)

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