config

package
v0.6.7 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DevMode  = "dev"
	TestMode = "test"
	ProdMode = "prod"
)

Variables

This section is empty.

Functions

func DefaultBool

func DefaultBool(key string, def bool) bool

DefaultBool return bool

func DefaultFloat

func DefaultFloat(key string, def float64) float64

DefaultFloat return float64

func DefaultInt

func DefaultInt(key string, def int) int

DefaultInt get default int

config.DefaultInt("prov_id",1)

func DefaultInt64

func DefaultInt64(key string, def int64) int64

DefaultInt64 DefaultInt64

func DefaultString

func DefaultString(key, def string) string

DefaultString get default string

config.DefaultString("prov","四川")

func GetBool

func GetBool(key string) (bool, error)

GetBool return bool

func GetFloat

func GetFloat(key string) (float64, error)

GetFloat return float64

func GetInt

func GetInt(key string) (int, error)

GetInt get int

config.GetInt("prov_id)

func GetInt64

func GetInt64(key string) (int64, error)

GetInt64 return int64 and error

func GetString

func GetString(key string) string

GetString get string

config.GetString("prov")

func InitLoad

func InitLoad(fileName string)

InitLoad 读取指定的配置文件

config.InitLoad("my.ini")
config.GetString("key")

func Keys

func Keys(section string) []string

Keys return all keys

func Reload added in v0.4.3

func Reload() error

Reload reload ini

func WriteContent added in v0.6.5

func WriteContent(content string) (n int, err error)

WriteContent write file

need content

func WriteFile added in v0.4.5

func WriteFile(filename, content string) (n int, err error)

WriteFile write a new file

need filename and content

Types

This section is empty.

Jump to

Keyboard shortcuts

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