conf

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: Apache-2.0 Imports: 10 Imported by: 140

Documentation

Index

Constants

View Source
const (
	StringType     = "string"
	IntType        = "int"
	Int64Type      = "int64"
	BoolType       = "bool"
	StringListType = "[]string"
	AliasMapType   = "[string string, string]"
)

conf types

Variables

View Source
var (
	NL  = []byte{'\n'}
	ANT = []byte{'#'}
)
View Source
var ErrHomeNotFound = errors.New("$HOME not found")

Functions

func ConfName

func ConfName() string

func ErrConfKeyType

func ErrConfKeyType(key, dataType string) error

func ErrConfMissingKey

func ErrConfMissingKey(key, dataType string) error

func ErrMissConfigAliasMap

func ErrMissConfigAliasMap(detailKeys string) error

func GetConfigDir

func GetConfigDir(app string) (dir string, err error)

func Init

func Init(cflag, app, default_conf string)

func Load

func Load(conf interface{}) (err error)

func LoadData

func LoadData(conf interface{}, data []byte) (err error)

func LoadEx

func LoadEx(conf interface{}, confName string) (err error)

func LoadFile

func LoadFile(conf interface{}, confName string) (err error)

Types

type AliasKey

type AliasKey struct {
	Key   string
	Alias string
}

type MapConf

type MapConf map[string]string

MapConf 基于Map的配置信息

func (MapConf) Get

func (conf MapConf) Get(key string) (interface{}, error)

func (MapConf) GetAliasList

func (c MapConf) GetAliasList(key string) (aks []AliasKey, err error)

func (MapConf) GetAliasMap

func (conf MapConf) GetAliasMap(key string) (map[string]string, error)

func (MapConf) GetAliasMapOr

func (conf MapConf) GetAliasMapOr(key string, deft map[string]string) (map[string]string, error)

func (MapConf) GetBool

func (conf MapConf) GetBool(key string) (bool, error)

func (MapConf) GetBoolOr

func (conf MapConf) GetBoolOr(key string, deft bool) (bool, error)

func (MapConf) GetInt

func (conf MapConf) GetInt(key string) (int, error)

func (MapConf) GetInt64

func (conf MapConf) GetInt64(key string) (int64, error)

func (MapConf) GetInt64Or

func (conf MapConf) GetInt64Or(key string, deft int64) (int64, error)

func (MapConf) GetIntOr

func (conf MapConf) GetIntOr(key string, deft int) (int, error)

func (MapConf) GetString

func (conf MapConf) GetString(key string) (string, error)

func (MapConf) GetStringList

func (conf MapConf) GetStringList(key string) ([]string, error)

func (MapConf) GetStringListOr

func (conf MapConf) GetStringListOr(key string, deft []string) ([]string, error)

func (MapConf) GetStringOr

func (conf MapConf) GetStringOr(key string, deft string) (string, error)

Jump to

Keyboard shortcuts

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