Documentation
¶
Overview ¶
Package db provides database connection management, migration system, and database creation utilities with support for SQLite and PostgreSQL.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Params ¶ added in v0.1.12
func Params(params ...string) connectionOption
Params allows to specify additional connection parameters that will be encoded as URL params next to the connection string. params should be in key,value,key,value,... format. e.g Params("sslmode", "disable", "timezone", "UTC")
func RunMigrations ¶
RunMigrations by checking in the migrations database table, each of the adapters take care of this.
func RunMigrationsDir ¶
RunMigrationsDir receives a folder and a database URL to apply the migrations to the database.
func WithDriver ¶
func WithDriver(name string) connectionOption
WithDriver allows to specify the driver to use driver defaults to postgres.
Types ¶
type ConnFn ¶
ConnFn is the database connection builder function that will be used by the application based on the driver and connection string.
func ConnectionFn ¶
ConnectionFn is the database connection builder function that will be used by the application based on the driver and connection string. It opens the connection only once and return the same connection on subsequent calls.