database

package
v0.0.0-...-c65c6a6 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2018 License: MIT Imports: 6 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はsql-migrateの設定ファイルと同じ形式を想定している

func (*Config) DSN

func (c *Config) DSN() string

DSNは設定されているDSNを返します

func (*Config) Open

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

OpenはConfigで指定されている接続先に接続する。 MySQL固定

type Configs

type Configs map[string]*Config

Configsは環境ごとの設定情報をもつ

func NewConfigs

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

NewConfigsはio.ReaderからDB用設定を読み取る

func NewConfigsFromFile

func NewConfigsFromFile(path string) (Configs, error)

NewConfigsFromFileはConfigから設定を読み取る

func (Configs) Open

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

Openは指定された環境についてDBに接続します。

Jump to

Keyboard shortcuts

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