Documentation
¶
Overview ¶
Package sqlitetest opens SQLite test databases with every connection rule of package sqlite on.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckLibc ¶
CheckLibc fails t when the build's modernc.org/libc differs from sqlite.LibcVersion.
Types ¶
type Faults ¶
type Faults struct {
// contains filtered or unexported fields
}
Faults holds the failures the connections of a handle from OpenWithFaults answer with.
func (*Faults) FailNextCommit ¶
FailNextCommit makes the next commit roll its transaction back and answer err.
func (*Faults) FailStatement ¶
FailStatement makes every statement whose text is exactly query answer err, inside transactions too.
type Template ¶
type Template struct {
// contains filtered or unexported fields
}
Template is a migrated and closed database file that each test opens a copy of.
func NewTemplate ¶
func NewTemplate( ctx context.Context, opts sqlite.Options, migrate func(ctx context.Context, db *sql.DB) error, ) (tp *Template, err error)
NewTemplate returns a template migrated once under ctx by migrate with opts in a new file of its own temp folder.
func (*Template) Close ¶
Close removes the folder of the template, and Open fails every test after it.