Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { // ConnMaxLifetime indicates the maximum amount of time a connection may be reused. ConnMaxLifetime time.Duration // ConnMaxIdleTime indicates the maximum amount of time a connection may be idle. ConnMaxIdleTime time.Duration // DriverName indicates the SQL driver to use, currently only supports: // - mysql // - postgres DriverName DriverName // MaxIdleConns indicates the maximum number of connections in the idle connection pool. MaxIdleConns int // MaxOpenConns indicates the maximum number of open connections to the database. MaxOpenConns int // SchemaSearchPath indicates the schema search path which is only used with "postgres". SchemaSearchPath string // SchemaMigrationsTable indicates the table name for storing the schema migration versions. SchemaMigrationsTable string // URI indicates the database connection string to connect. // // URI connection string documentation: // - mysql: https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html#connecting-using-uri // - postgres: https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING URI string }
Config indicates database connection configuration.
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a wrapper around sqlx.DB
type DriverName ¶
type DriverName string
DriverName indicates the name of the driver
const ( // MYSQL refers to the mysql driver MYSQL DriverName = "mysql" // POSTGRES refers to the postgres driver POSTGRES DriverName = "postgres" )
type Migrate ¶
type Migrate struct { *migrate.Migrate // contains filtered or unexported fields }
Migrate is the DB migrator.
func NewMigrate ¶
NewMigrate initialises the DB migrator with open connection.
Click to show internal directories.
Click to hide internal directories.