Documentation
¶
Overview ¶
Package storagetest provides in-memory fakes for the storage.DBTX and storage.Transaction interfaces, for unit tests that drive sqlc-generated queries without a real database.
Index ¶
- func Row(fn func(dest ...any) error) pgx.Row
- func Rows(scans ...func(dest ...any) error) pgx.Rows
- type Fake
- func (Fake) Commit(context.Context) error
- func (f Fake) Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
- func (f Fake) Query(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
- func (f Fake) QueryRow(ctx context.Context, sql string, args ...any) pgx.Row
- func (Fake) Rollback(context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Fake ¶
type Fake struct {
QueryFunc func(ctx context.Context, sql string, args ...any) (pgx.Rows, error)
QueryRowFunc func(ctx context.Context, sql string, args ...any) pgx.Row
ExecFunc func(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
}
Fake is a configurable storage.Transaction. Set only the hooks the code under test uses; an unset hook fails the call so unexpected access is caught.
Click to show internal directories.
Click to hide internal directories.