Documentation ¶
Index ¶
Constants ¶
View Source
const ( DefaultMaxOpenConns int = 25 DefaultMaxIdleConns int = 5 DefaultMaxLifetime time.Duration = 5 * time.Minute DefaultMaxIdleTime time.Duration = 5 * time.Minute )
Default values for configuring the DB connection pool. Values taken from https://www.alexedwards.net/blog/configuring-sqldb - accessed 2023/01/28.
Variables ¶
View Source
var ErrNoRows = sql.ErrNoRows
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { User string `json:"user"` Password string `json:"password"` Protocol string `json:"protocol"` Host string `json:"host"` Port int `json:"port"` DBName string `json:"db_name"` Dialect string `json:"dialect"` }
Config provides a database configuration. Not all fields will be used dependent on database dialect being used.
func DefaultConfig ¶
func DefaultConfig() Config
type DB ¶
func Open ¶
Open is a convenience function that wraps sql.Open to establish a connection to the DB and verifies the connection, in one step, as well as setting sensible default values for the connection pool.
func (*DB) DestructiveReset ¶
func (*DB) MigrateDown ¶
func (*DB) SetMigrationPath ¶
Click to show internal directories.
Click to hide internal directories.