config

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2020 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 {
	Projects  []Project
	Databases []Database
}

Config struct Config yaml file.

func NewConfig

func NewConfig(path string, projects, databases []string) (Config, error)

NewConfig init Config from file.

func (*Config) GetDB

func (c *Config) GetDB(name string) (Database, error)

GetDB gets database object by name.

func (*Config) GetProject

func (c *Config) GetProject(name string) (Project, error)

GetProject gets project object by name.

type Database

type Database struct {
	Name   string
	TypeDB string
	DSN    string
	Schema string
}

Database struct for Database connection.

type Project

type Project struct {
	Name       string
	Migrations []ProjectMigration
}

Project struct Project for Config.

func (*Project) GetDB

func (p *Project) GetDB(name string) (Database, error)

GetDB gets database object by name.

func (*Project) GetProjectMigration

func (p *Project) GetProjectMigration(dbName string) (ProjectMigration, error)

GetProjectMigration gets relation database in project by database name.

type ProjectMigration

type ProjectMigration struct {
	Path     string
	Database *Database
}

ProjectMigration struct relation Project with Database.

type YAMLConfig

type YAMLConfig struct {
	Projects  map[string]YAMLConfigProject  `yaml:"projects"`
	Databases map[string]YAMLConfigDatabase `yaml:"databases"`
}

YAMLConfig takes configuration values from YAML file.

type YAMLConfigDatabase

type YAMLConfigDatabase struct {
	Type   string `yaml:"type"`
	DSN    string `yaml:"dsn"`
	Schema string `yaml:"schema"`
}

YAMLConfigDatabase is a block for parse databases in YAML config file.

type YAMLConfigProject

type YAMLConfigProject struct {
	Migrations []map[string]string `yaml:"migrations"`
}

YAMLConfigProject is a block for parse projects in YAML config file.

Jump to

Keyboard shortcuts

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