core

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

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

Go to latest
Published: May 13, 2019 License: BSD-3-Clause Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetDbConn

func GetDbConn() *gorm.DB

func InitDbConn

func InitDbConn(dbCfg *DatabaseArgs) error

Types

type Config

type Config struct {
	Bind     string `env:"BIND"`
	Port     int    `env:"PORT"`
	Database DatabaseArgs

	Extras env.EnvSet
}

func GetSettings

func GetSettings() *Config

func (*Config) LoadEnv

func (this *Config) LoadEnv()

LoadEnv sets up Config struct from environment variables.

type DatabaseArgs

type DatabaseArgs struct {
	Type string `env:"DATABASE_TYPE"`

	Host string `env:"DATABASE_HOST"`
	Port string `env:"DATABASE_PORT"`

	Name string `env:"DATABASE_NAME"`

	User     string `env:"DATABASE_USER"`
	Password string `env:"DATABASE_PASSWORD"`
}

func (*DatabaseArgs) Args

func (a *DatabaseArgs) Args() (string, string, error)

DatabaseArgs detects and returns database type and connection arguments.

Jump to

Keyboard shortcuts

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