Documentation ¶
Index ¶
- Variables
- func ConnString() string
- func CreateMigrationsTable() error
- func DeleteMigration(id string) error
- func DropMigrationsTable() error
- func InitConnection()
- func InsertMigration(id string) error
- func MigrationActive(id string) (bool, error)
- func MigrationsTablePresent() bool
- func UseDB() error
- func VerifyConnection(c *sql.DB) error
Constants ¶
This section is empty.
Variables ¶
var ( // Conn the active database connection Conn *sql.DB // ErrUnableToParseDBConnection is raised when there are missing or invalid details for the database connection. ErrUnableToParseDBConnection = errors.New("unable to parse database connection details") // ErrUnableToConnectToDB is raised when a connection to the database cannot be established. ErrUnableToConnectToDB = errors.New("unable to connect to the database") )
Functions ¶
func ConnString ¶
func ConnString() string
ConnString returns the connection string for the database driver.
func CreateMigrationsTable ¶
func CreateMigrationsTable() error
CreateMigrationsTable creates the migrations table in the database.
func DeleteMigration ¶
DeleteMigration deletes a migration from the migrations table.
func DropMigrationsTable ¶
func DropMigrationsTable() error
DropMigrationsTable drops the migrations table from the database.
func InsertMigration ¶
InsertMigration inserts a new migration into the migrations table.
func MigrationActive ¶
MigrationActive queries the migrations table for the migration ID and returns true if a result is found.
func MigrationsTablePresent ¶
func MigrationsTablePresent() bool
MigrationsTablePresent returns true if the migrations is not present in the database.
func UseDB ¶
func UseDB() error
UseDB runs the `USE` SQL command, ensuring that all future SQL commands on the database connection use the named database.
func VerifyConnection ¶
VerifyConnection pings the database to verify a connection is established. If the connection cannot be established, it will retry with an exponential back off.
Types ¶
This section is empty.