app

package
v0.0.0-...-c460348 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnectDB

func ConnectDB(dbConfig *DBConfig) (*sqlx.DB, error)

ConnectDB connects to a Postgres database.

Types

type Config

type Config struct {
	Database DBConfig         `mapstructure:"database"`
	HTTP     HTTPServerConfig `mapstructure:"http"`
}

Config represents the top level config.

func LoadConfig

func LoadConfig() (*Config, error)

LoadConfig sets up viper and returns the application configuration

type DBConfig

type DBConfig struct {
	Host     string `mapstructure:"host"`
	Port     int    `mapstructure:"port"`
	Name     string `mapstructure:"name"`
	Username string `mapstructure:"user"`
	Password string `mapstructure:"password"`
}

DBConfig contains the fields needed to connect to the RDBMS.

type HTTPServerConfig

type HTTPServerConfig struct {
	Port int `mapstructure:"port"`
}

HTTPServerConfig contains the config for HTTP server

Jump to

Keyboard shortcuts

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