Documentation ¶
Index ¶
- Variables
- func BuildConnectionString(cd ConnectionData) (string, error)
- func New(db, dsn string, ops *Options) (*sql.DB, error)
- func NewMariaDB(dsn string, ops *Options) (*sql.DB, error)
- func NewPostgres(dsn string, ops *Options) (*sql.DB, error)
- func NewSQLite(dsn string, ops *Options) (*sql.DB, error)
- type ConnectionData
- type Options
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MaxOpenConns = 12 // Maximum number of open connections in our pool. MaxIdleConns = 6 // Maximum idle connections in our pool. ConnMaxLifetime = 0 * time.Second // Max lifetime for a connection (how long before it expires). 0 is forever. )
Functions ¶
func BuildConnectionString ¶ added in v1.1.0
func BuildConnectionString(cd ConnectionData) (string, error)
BuildConnectionString takes information stored in a ConnectionData variable and builds a connection string for postgres/mysql.
func New ¶
New is a factory method which takes a db type, a DSN and options and attempts to open a connection to the database and return a pool of connections.
func NewMariaDB ¶
NewMariaDB is a convenience function for getting a pool of MariaDB/MySQL connections.
func NewPostgres ¶
NewPostgres is a convenience function for getting a pool of Postgres connections.
Types ¶
Click to show internal directories.
Click to hide internal directories.