Documentation
¶
Overview ¶
Package sqlstore implements storage.Store on database/sql. A driver supplies a Dialect: its schema migrations and the few behaviors that differ between databases. The SQL it issues is portable across SQLite, PostgreSQL and MySQL; times are stored as Unix microseconds.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IgnoreSuffix ¶
IgnoreSuffix is InsertIgnore for databases with ON CONFLICT DO NOTHING.
Types ¶
type Dialect ¶
type Dialect struct {
// Migrations holds *.sql files applied in name order, each once.
// Statements are separated by ";" at the end of a line.
Migrations fs.FS
// Numbered selects numbered placeholders ($1, $2, ...) instead of "?".
Numbered bool
// InsertIgnore turns an INSERT into one that skips rows violating a
// unique constraint.
InsertIgnore func(insert string) string
// Conflict reports errors that mean a concurrent change won: unique
// violations, deadlocks, serialization failures, busy databases.
Conflict func(error) bool
// Lock, if set, serializes migrations across instances on conn. The
// returned unlock function releases the lock.
Lock func(ctx context.Context, conn *sql.Conn) (unlock func(), err error)
}
Dialect describes a database.