exec

package
v1.2.1 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanCommonHook

func CleanCommonHook()

func RegisterATExecutor

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

RegisterATExecutor AT executor

func RegisterCommonHook

func RegisterCommonHook(hook SQLHook)

RegisterCommonHook not goroutine safe

func RegisterHook

func RegisterHook(hook SQLHook)

RegisterHook not goroutine safe

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)

func (*BaseExecutor) ExecWithValue

ExecWithValue

func (*BaseExecutor) Interceptors

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

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 []SQLHook)
	ExecWithNamedValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithNamedValue) (types.ExecResult, error)
	ExecWithValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithNamedValue) (types.ExecResult, error)
}

func BuildExecutor

func BuildExecutor(dbType types.DBType, transactionMode types.TransactionMode, query string) (SQLExecutor, error)

BuildExecutor use db type and transaction type to build an executor. the executor can add custom hook, and intercept the user's business sql to generate the undo log.

type SQLHook

type SQLHook interface {
	Type() types.SQLType
	Before(ctx context.Context, execCtx *types.ExecContext) error
	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