env

package
v0.0.0-...-06a57e6 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2017 License: Apache-2.0 Imports: 8 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 {
	KV map[string]string
	sync.RWMutex
}

data struct to hold a group of config parameters, with key type default as string and value store in string format

var CmdArgs *Config = nil

CmdArgs will hold all the key-value parameters that were given in command line

var SysEnv *Config = nil

SysEnv will hold all the key-value parameters from the os environment

func NewConfig

func NewConfig(path string) *Config

func (*Config) LoadFromFile

func (c *Config) LoadFromFile(path string) error

read all the config key-value pair from config file defined by path

func (*Config) Set

func (c *Config) Set(key string, val interface{})

all value will be set and store in string formation, ValTYPE method will get the value with TYPE formation value of boolean type can be set as 0, 1 or false, true

func (*Config) ValBool

func (c *Config) ValBool(key string) (bool, error)

func (*Config) ValFloat64

func (c *Config) ValFloat64(key string) (float64, error)

func (*Config) ValInt64

func (c *Config) ValInt64(key string) (int64, error)

func (*Config) ValString

func (c *Config) ValString(key string) (string, error)

Jump to

Keyboard shortcuts

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