db

package
v0.0.0-...-37285d9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 3, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DBMultiStatement - global database object which can issue multiple statements at once
	DBMultiStatement *sql.DB

	// ErrEmptyEnv - used for telling if an environment variable failed to be loaded.
	ErrEmptyEnv = errors.New("environment variable cannot be empty")
)

Functions

func DoMigrations

func DoMigrations(db *sql.DB, project string) (err error)

DoMigrations - performs all the migrations registered to the migrations map

func RegisterMigration

func RegisterMigration(m Migration)

RegisterMigration - Checks if the migration has been applied, and will queued if it hasnn't been applied yet.

func SetupDB

func SetupDB(user, host, password, port string, multiStatements bool) (err error)

SetupDB - Setups up the DB with a tcp connection\][']

func SetupMultistatementDBWithEnv

func SetupMultistatementDBWithEnv() (err error)

SetupMultistatementDBWithEnv - setup to allow multiple statements per query

Types

type Migration

type Migration struct {
	Version int
	Name    string
	Query   string
	Project string
}

Migration - The struct representing a migration

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL