Versions in this module Expand all Collapse all v0 v0.4.0 Nov 24, 2026 Changes in this version + const DefaultLeaseTTL + const ServerLockKey + var ErrSchemaBehindWithOtherServers = errors.New("the database schema is behind this sqi-server") + var ErrServerLockHeld = errors.New(...) + var ErrUnreadableArchive = errors.New("postgres: unreadable archive") + func ArchiveSchemaVersion(ctx context.Context, archive string) (int64, error) + func BackupDSN(ctx context.Context, dsn, out string, log *slog.Logger) error + func CheckRestoreTool(ctx context.Context, dsn string) error + func RequireEmptyDatabase(ctx context.Context, dsn string) error + func Restore(ctx context.Context, dsn, archive string, log *slog.Logger) error + func SchemaVersion(ctx context.Context, db *sql.DB) (int64, error) + func SchemaVersionDSN(ctx context.Context, dsn string) (int64, error) + type DatabaseLock struct + func LockDatabase(ctx context.Context, dsn string, log *slog.Logger) (*DatabaseLock, error) + func (d *DatabaseLock) Release() error + type Options struct + AutoMigrate bool + ForceTxRetry bool + HA bool + LeaseTTL time.Duration + Logger *slog.Logger + MaxConns int + ServerLock bool + WrapDialect func(sqlstore.Dialect) sqlstore.Dialect + func DefaultOptions() Options + type Store struct + func Open(ctx context.Context, dsn string, opts Options) (*Store, error) + func (s *Store) Close() error + func (s *Store) DSNForTest() string + func (s *Store) Ping(ctx context.Context) error