config

package
v0.0.0-...-c4b29bc Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: MIT Imports: 4 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 {
	DB  Database `mapstructure:"database"`
	Web Web      `mapstructure:"web"`
}

Config is global config

func Load

func Load() (*Config, error)

Load loads configs

type Database

type Database struct {
	Host            string        `mapstructure:"host"`
	Port            int           `mapstructure:"port"`
	DBName          string        `mapstructure:"db_name"`
	User            string        `mapstructure:"user"`
	Password        string        `mapstructure:"password"`
	MaxIdleConns    int           `mapstructure:"max_idle_conns"`
	MaxOpenConns    int           `mapstructure:"max_open_conns"`
	ConnMaxLifetime time.Duration `mapstructure:"conn_max_life_time"`
}

Database is database config

func (*Database) BuildDSN

func (d *Database) BuildDSN() string

BuildDSN builds data source name

type Web

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

Web is web config

Jump to

Keyboard shortcuts

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