Documentation ¶
Index ¶
- func CleanCommonHook()
- func RegisterATExecutor(dt types.DBType, builder func() SQLExecutor)
- func RegisterCommonHook(hook SQLHook)
- func RegisterHook(hook SQLHook)
- 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 CallbackWithNamedValue) (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, builder func() SQLExecutor)
RegisterATExecutor AT executor
func RegisterCommonHook ¶
func RegisterCommonHook(hook SQLHook)
RegisterCommonHook 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 ¶
func (e *BaseExecutor) ExecWithValue(ctx context.Context, execCtx *types.ExecContext, f CallbackWithNamedValue) (types.ExecResult, error)
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 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 (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.