Documentation
¶
Overview ¶
@index Database connection and search-backend selection helpers for SQLite and PostgreSQL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConfigurePool ¶
ConfigurePool applies database-specific connection pool settings. @intent apply connection-pool limits that match each database driver's concurrency model. @domainRule sqlite is pinned to MaxOpenConns=1 because it supports only one writer at a time. @mutates sqlDB connection-pool settings.
func NewSearchBackend ¶
NewSearchBackend selects the search backend for the database driver. @intent select the full-text search backend implementation that matches the active database driver. @domainRule postgres uses the PostgreSQL backend and every other driver falls back to the SQLite backend.
func Open ¶
Open creates a configured GORM connection for sqlite or postgres. @intent centralize driver-specific GORM initialization and pool setup behind one entry point. @requires driver must be sqlite or postgres and dsn must match the selected driver. @ensures returns a configured GORM connection with pool settings applied for the selected driver. @sideEffect enables SQLite WAL and busy_timeout pragmas when driver is sqlite.
Types ¶
type SQLDBPool ¶
type SQLDBPool interface {
SetMaxOpenConns(int)
SetMaxIdleConns(int)
SetConnMaxLifetime(time.Duration)
SetConnMaxIdleTime(time.Duration)
}
SQLDBPool abstracts configurable SQL connection pool knobs. @intent abstract the pool configuration API so both real sql.DB handles and test doubles can share the same seam.