Documentation ¶
Index ¶
- Variables
- func New(logger *slog.Logger, ops ...Option) func(dialect.Driver) dialect.Driver
- type Handler
- type Option
- type SlogDriver
- func (d *SlogDriver) BeginTx(ctx context.Context, opts *sql.TxOptions) (dialect.Tx, error)
- func (d *SlogDriver) Exec(ctx context.Context, query string, args, v any) error
- func (d *SlogDriver) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *SlogDriver) Query(ctx context.Context, query string, args, v any) error
- func (d *SlogDriver) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (d *SlogDriver) Tx(ctx context.Context) (dialect.Tx, error)
- type SlogTx
- func (d *SlogTx) Commit() error
- func (d *SlogTx) Exec(ctx context.Context, query string, args, v any) error
- func (d *SlogTx) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *SlogTx) Query(ctx context.Context, query string, args, v any) error
- func (d *SlogTx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (d *SlogTx) Rollback() error
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOption = Option{}
Functions ¶
Types ¶
type SlogDriver ¶
type SlogDriver struct { dialect.Driver // underlying driver. // log function. defaults to slog.Default() Handler }
SlogDriver is a driver that logs all driver operations.
func (*SlogDriver) BeginTx ¶
BeginTx adds an log-id for the transaction and calls the underlying driver BeginTx command if it is supported.
func (*SlogDriver) ExecContext ¶
func (d *SlogDriver) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
ExecContext logs its params and calls the underlying driver ExecContext method if it is supported.
func (*SlogDriver) QueryContext ¶
func (d *SlogDriver) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
QueryContext logs its params and calls the underlying driver QueryContext method if it is supported.
type SlogTx ¶
type SlogTx struct { dialect.Tx // underlying transaction. Handler // contains filtered or unexported fields }
SlogTx is a transaction implementation that logs all transaction operations.
func (*SlogTx) ExecContext ¶
ExecContext logs its params and calls the underlying transaction ExecContext method if it is supported.
func (*SlogTx) QueryContext ¶
QueryContext logs its params and calls the underlying transaction QueryContext method if it is supported.
Click to show internal directories.
Click to hide internal directories.