config

package
v0.0.0-...-18c487f Latest Latest
Warning

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

Go to latest
Published: May 17, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

该文件主要是为了封装config

Index

Constants

View Source
const (
	CONFIGPATH = "conf/config.toml" //配置文件默认位置
)

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig() (err error)

加载配置

Types

type Config

type Config struct {
	Age        int
	Cats       []string
	Pi         float64
	Perfection []int
	DOB        time.Time // requires `import time`

	DB      DB
	Redis   Redis
	Mongodb Mongodb
}

配置实体

var (
	Conf *Config // 配置

)

type DB

type DB struct {
	Host     string `json:"host"`
	Port     string `json:"port"`
	User     string `json:"user"`
	Password string `json:"password"`
	DbName   string `json:"dbName"`
}

type Mongodb

type Mongodb struct {
	Dsn      string `json:"dsn"`
	Password string `json:"password"`
	DbName   string `json:"dbName"`
}

type Redis

type Redis struct {
	NetType  string `toml:"netType"`
	Addr     string `toml:"addr"`
	Password string `toml:"password"`
}

Jump to

Keyboard shortcuts

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