Documentation
¶
Overview ¶
Package exec defines the seam between ant and database/sql.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Error ¶
Error is a failed statement. Its message is the driver's own, unless Detailed is set, so SQL only reaches logs and users on request.
type Executor ¶
type Executor interface {
ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
}
Executor is the part of *sql.DB, *sql.Tx, and *sql.Conn that ant uses to run statements.
type Interceptor ¶
type Interceptor interface {
Before(ctx context.Context, s *Statement) (context.Context, error)
After(ctx context.Context, s *Statement, o Outcome)
}
Interceptor observes statements. Before can replace the context, and stop the statement by returning an error.
type Observed ¶
type Observed struct {
Executor
Interceptors []Interceptor
Replica bool
Detailed bool
}
Observed runs statements through interceptors.
func (*Observed) ExecContext ¶
ExecContext implements Executor.
type Plain ¶
Plain runs statements with no interceptors, and records which one failed.
func (*Plain) ExecContext ¶
ExecContext implements Executor.