Documentation ¶
Index ¶
- Variables
- func CompareQuery(a, b string) (bool, error)
- func Dump(t *testing.T, s *SQL, opts ...Option)
- func Write(sql *SQL, transformers ...func(*SQL) error) ([]byte, error)
- type DB
- func (d *DB) Exec(query string, args ...any) (sql.Result, error)
- func (d *DB) ExecContext(ctx context.Context, query string, args ...any) (sql.Result, error)
- func (d *DB) Prepare(query string) (*sql.Stmt, error)
- func (d *DB) PrepareContext(ctx context.Context, query string) (*sql.Stmt, error)
- func (d *DB) Query(query string, args ...any) (*sql.Rows, error)
- func (d *DB) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)
- func (d *DB) QueryRow(query string, args ...any) *sql.Row
- func (d *DB) QueryRowContext(ctx context.Context, query string, args ...any) *sql.Row
- func (d *DB) SetDB(db dbtx)
- type Dumper
- type Option
- type Recorder
- type SQL
Constants ¶
This section is empty.
Variables ¶
View Source
var Prettify = Transformers(func(s *SQL) error { q, err := sqlformat.Format(s.Query) if err != nil { return err } s.Query = q return nil })
Functions ¶
func CompareQuery ¶
CompareQuery checks if two queries are equal.
Types ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
func NewDBRecorder ¶
func NewDBRecorder(db dbtx, rec recorder) *DB
func (*DB) ExecContext ¶
func (*DB) PrepareContext ¶
func (*DB) QueryContext ¶
func (*DB) QueryRowContext ¶
type Recorder ¶
type Recorder struct {
// contains filtered or unexported fields
}
Recorder logs the query and args.
func (*Recorder) SetOptionsAt ¶
SetOptionsAt sets the options for the id-th call.
Click to show internal directories.
Click to hide internal directories.