sql

package
v0.0.0-...-1baf13c Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Connect

func Connect(driver, dsn string, n int, opts ...DBSetupOpt) (*sqlx.DB, error)

Connect tries to connect to a database up to n times. There are `DBSetupOpt`s to do things like run migrations, create system objects, etc.

func CreateDBIfNotExist

func CreateDBIfNotExist(dsn string) error

Types

type DBSetupOpt

type DBSetupOpt func(*sql.DB) error

DBSetupOpt is a function to perform some setup task on a database.

func CloseDB

func CloseDB() DBSetupOpt

func CreateDB

func CreateDB(dbname string) DBSetupOpt

CreateDB creates and "USE"s a database.

func Migrate

func Migrate(dsn string, service string, sqlPath string) DBSetupOpt

Migrate runs migrations. It's supposed to run in production, so assume the target database is CockroachDB.

Directories

Path Synopsis
helpers

Jump to

Keyboard shortcuts

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