Documentation
¶
Index ¶
- func CleanCommonHook()
- func RegisterATExecutor(dt types.DBType, et types.ExecutorType, builder func() SQLExecutor)
- func RegisterCommonHook(hook SQLHook)
- func RegisterHook(hook SQLHook)
- func RegisterXAExecutor(dt types.DBType, builder func() SQLExecutor)
- type BaseExecutor
- func (e *BaseExecutor) ExecWithNamedValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithNamedValue) (types.ExecResult, error)
- func (e *BaseExecutor) ExecWithValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithValue) (types.ExecResult, error)
- func (e *BaseExecutor) Interceptors(interceptors []SQLHook)
- type CallbackWithNamedValue
- type CallbackWithValue
- type SQLExecutor
- type SQLHook
- type SelectForUpdateExecutor
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 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 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 (s SelectForUpdateExecutor) ExecWithNamedValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithNamedValue) (types.ExecResult, error)
func (SelectForUpdateExecutor) ExecWithValue ¶
func (s SelectForUpdateExecutor) ExecWithValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithValue) (types.ExecResult, error)
Click to show internal directories.
Click to hide internal directories.