exec

package
v1.0.2-rc2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2022 License: Apache-2.0 Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanCommonHook

func CleanCommonHook()

func RegisterATExecutor

func RegisterATExecutor(dt types.DBType, et types.ExecutorType, builder func() SQLExecutor)

RegisterATExecutor

func RegisterCommonHook

func RegisterCommonHook(hook SQLHook)

RegisCommonHook not goroutine safe

func RegisterHook

func RegisterHook(hook SQLHook)

RegisterHook not goroutine safe

func RegisterXAExecutor

func RegisterXAExecutor(dt types.DBType, builder func() SQLExecutor)

RegisterXAExecutor

Types

type BaseExecutor

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

func (*BaseExecutor) ExecWithNamedValue

func (e *BaseExecutor) ExecWithNamedValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithNamedValue) (types.ExecResult, error)

ExecWithNamedValue

func (*BaseExecutor) ExecWithValue

func (e *BaseExecutor) ExecWithValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithValue) (types.ExecResult, error)

ExecWithValue

func (*BaseExecutor) Interceptors

func (e *BaseExecutor) Interceptors(interceptors []SQLHook)

Interceptors

type CallbackWithNamedValue

type CallbackWithNamedValue func(ctx context.Context, query string, args []driver.NamedValue) (types.ExecResult, error)

type CallbackWithValue

type CallbackWithValue func(ctx context.Context, query string, args []driver.Value) (types.ExecResult, error)

type SQLExecutor

type SQLExecutor interface {
	// Interceptors
	Interceptors(interceptors []SQLHook)
	// Exec
	ExecWithNamedValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithNamedValue) (types.ExecResult, error)
	// Exec
	ExecWithValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithValue) (types.ExecResult, error)
}

func BuildExecutor

func BuildExecutor(dbType types.DBType, txType types.TransactionType, query string) (SQLExecutor, error)

BuildExecutor

type SQLHook

type SQLHook interface {
	Type() types.SQLType

	// Before
	Before(ctx context.Context, execCtx *types.ExecContext) error

	// After
	After(ctx context.Context, execCtx *types.ExecContext) error
}

SQLHook SQL execution front and back interceptor case 1. Used to intercept SQL to achieve the generation of front and rear mirrors case 2. Burning point to report case 3. SQL black and white list

type SelectForUpdateExecutor

type SelectForUpdateExecutor struct {
	builder.BasicUndoLogBuilder
}

func (SelectForUpdateExecutor) ExecWithNamedValue

func (SelectForUpdateExecutor) ExecWithValue

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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