Versions in this module Expand all Collapse all v2 v2.1.0 Nov 1, 2026 Changes in this version + var ErrDirtyDatabase = errors.New(...) + var ErrInvalidCursor = errors.New("invalid page cursor") + var ErrInvalidPageSize = errors.New("page size must not be negative") type Option + func WithLogger(logger *slog.Logger) Option v2.0.0 Oct 31, 2026 Changes in this version + const MaxPageSize + var ErrDatabaseTooNew = errors.New("database may be newer than migrations available in this binary") + var ErrMutuallyExclusive = errors.New("after and before are mutually exclusive") + var ErrNoDSN = errors.New("no data source name given") + func Open(opts ...Option) (*sql.DB, error) + func OpenSQLX(opts ...Option) (*sqlx.DB, error) + func RunTx(ctx context.Context, db *sqlx.DB, fn func(tx *sqlx.Tx) error) error + func ValidSQLIdentifier(s string) bool + type DriverForFunc func(*sql.DB) (database.Driver, string, error) + type EntityQueryRowxFunc func(ctx context.Context, entity T) (T, error) + func NewEntityQueryRowxFunc[T any](db *sqlx.DB, stmt string) EntityQueryRowxFunc[T] + type ExecFunc func(ctx context.Context, args ...any) error + func NewExecFunc(db *sqlx.DB, stmt string) ExecFunc + type NamedExecFunc func(ctx context.Context, entity T) (Result, error) + func NewNamedExecFunc[T any](db *sqlx.DB, stmt string) NamedExecFunc[T] + type Option func(*config) error + func WithDSN(dsn string) Option + func WithDriver(driverName string) Option + func WithMigrationDriver(sqlDriverName string, migrateName string, ...) Option + func WithMigrations(fileSystem fs.FS, path string) Option + func WithPragmas(pragmas ...string) Option + type PageRequest struct + After string + Before string + PageSize int + func (p PageRequest) IsPaginated() bool + type PageResponse struct + FirstCursor string + HasMore bool + LastCursor string + type PaginatedSelectFunc func(ctx context.Context, page PageRequest, args ...any) ([]T, PageResponse, error) + func NewPaginatedSelectFunc[T any](db *sqlx.DB, table, orderCol, baseWhere string, cursorFn func(T) string) PaginatedSelectFunc[T] + type QueryRowxFunc func(ctx context.Context, args ...any) (T, error) + func NewQueryRowxFunc[T any](db *sqlx.DB, stmt string) QueryRowxFunc[T] + type QueryxIteratorFunc func(ctx context.Context, args ...any) func(func(T, error) bool) + func NewQueryxIteratorFunc[T any](db *sqlx.DB, stmt string) QueryxIteratorFunc[T] + type Result struct + func NewResult(sqlResult sql.Result) Result + func (r Result) LastInsertID() (int64, bool) + func (r Result) RowsAffected() (int64, bool) + type SelectFunc func(ctx context.Context, args ...any) ([]T, error) + func NewSelectFunc[T any](db *sqlx.DB, stmt string) SelectFunc[T] + type TxBatchExecFunc func(ctx context.Context, tx *sqlx.Tx, entities []T) ([]Result, error) + func NewTxBatchExecFunc[T any](db *sqlx.DB, head, row string, maxRows int) TxBatchExecFunc[T] + type TxEntityQueryRowxFunc func(ctx context.Context, tx *sqlx.Tx, entity T) (T, error) + func NewTxEntityQueryRowxFunc[T any](db *sqlx.DB, stmt string) TxEntityQueryRowxFunc[T] + type TxExecFunc func(ctx context.Context, tx *sqlx.Tx, args ...any) error + func NewTxExecFunc(db *sqlx.DB, stmt string) TxExecFunc + type TxNamedExecFunc func(ctx context.Context, tx *sqlx.Tx, entity T) (Result, error) + func NewTxNamedExecFunc[T any](db *sqlx.DB, stmt string) TxNamedExecFunc[T] + type TxQueryRowxFunc func(ctx context.Context, tx *sqlx.Tx, args ...any) (T, error) + func NewTxQueryRowxFunc[T any](db *sqlx.DB, stmt string) TxQueryRowxFunc[T] Other modules containing this package github.com/borud/dbx