Versions in this module Expand all Collapse all v0 v0.14.1 Jan 16, 2025 v0.14.0 Dec 18, 2024 Changes in this version + const SQLITE_DRIVER_NAME + const SQLite3MaxVariables + var ErrUserExists = errors.New("username already exists") + func EndTransaction(txn Transaction, succeeded *bool) error + func EndTransactionWithCheck(txn Transaction, succeeded *bool, err *error) + func InsertMigration(ctx context.Context, db *sql.DB, migrationName string) error + func IsUniqueConstraintViolationErr(err error) bool + func Open(dbProperties *config.DatabaseOptions, writer Writer) (*sql.DB, error) + func ParseFileURI(dataSourceName config.DataSource) (string, error) + func QueryVariadic(count int) string + func QueryVariadicOffset(count, offset int) string + func RunLimitedVariablesExec(ctx context.Context, query string, qp ExecProvider, variables []interface{}, ...) error + func RunLimitedVariablesQuery(ctx context.Context, query string, qp QueryProvider, variables []interface{}, ...) error + func TxStmt(transaction *sql.Tx, statement *sql.Stmt) *sql.Stmt + func TxStmtContext(context context.Context, transaction *sql.Tx, statement *sql.Stmt) *sql.Stmt + func WithTransaction(db *sql.DB, fn func(txn *sql.Tx) error) (err error) + type Connections struct + func NewConnectionManager(processCtx *process.ProcessContext, globalConfig config.DatabaseOptions) *Connections + func (c *Connections) Connection(dbProperties *config.DatabaseOptions) (*sql.DB, Writer, error) + type DummyWriter struct + func (w *DummyWriter) Do(db *sql.DB, txn *sql.Tx, f func(txn *sql.Tx) error) error + type ExclusiveWriter struct + func (w *ExclusiveWriter) Do(db *sql.DB, txn *sql.Tx, f func(txn *sql.Tx) error) error + type ExecProvider interface + ExecContext func(ctx context.Context, query string, args ...interface{}) (sql.Result, error) + type Migration struct + Down func(ctx context.Context, txn *sql.Tx) error + Up func(ctx context.Context, txn *sql.Tx) error + Version string + type Migrator struct + func NewMigrator(db *sql.DB) *Migrator + func (m *Migrator) AddMigrations(migrations ...Migration) + func (m *Migrator) ExecutedMigrations(ctx context.Context) (map[string]struct{}, error) + func (m *Migrator) Up(ctx context.Context) error + type QueryProvider interface + QueryContext func(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) + type StatementList []struct + func (s StatementList) Prepare(db *sql.DB) (err error) + type Transaction interface + Commit func() error + Rollback func() error + type Writer interface + Do func(db *sql.DB, txn *sql.Tx, f func(txn *sql.Tx) error) error + func NewDummyWriter() Writer + func NewExclusiveWriter() Writer