db

package
Version: v0.0.0-...-1cbb4d5 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Datasource string `yaml:"datasource"`
}

Config is a database configuration. It's save as sql-migrate schema style.

see also: https://github.com/rubenv/sql-migrate

func (*Config) DSN

func (c *Config) DSN() string

DSN returns data source name configured.

func (*Config) Open

func (c *Config) Open() (*sql.DB, error)

Open connets database.

type Configs

type Configs map[string]*Config

Configs have configuration for each environment.

func NewConfigs

func NewConfigs(r io.Reader) (Configs, error)

NewConfigs reads configs from io.Reader.

func NewConfigsFromFile

func NewConfigsFromFile(path string) (Configs, error)

NewConfigsFromFile reads settings from file.

func (Configs) Open

func (cs Configs) Open(env string) (*sql.DB, error)

Open creates connection between database for each environment.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL