xconfig

package
v1.0.9 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_CONFIG_FILE = "config.yaml"
)
View Source
const (
	// 默认配置实例名称
	DEFAULT_GROUP_NAME = "default"
)

Variables

This section is empty.

Functions

func ClearContent

func ClearContent()

清空配置内容

func GetContent

func GetContent(file ...string) string

获取配置文件内容

func RemoveConfig

func RemoveConfig(file ...string)

删除配置文件, 并从缓存中删除

func SetContent

func SetContent(content string, file ...string)

保存配置内容

Types

type TConfig

type TConfig struct {
	// contains filtered or unexported fields
}

func Config

func Config(name ...string) *TConfig

func Instance

func Instance(name ...string) *TConfig

获取配置实例

func New

func New(file ...string) *TConfig

func (*TConfig) AddPath

func (c *TConfig) AddPath(path string) error

增加搜索目录

func (*TConfig) Clear

func (c *TConfig) Clear()

func (*TConfig) Contains

func (c *TConfig) Contains(pattern string) bool

func (*TConfig) FilePath

func (c *TConfig) FilePath(file ...string) (path string)

func (*TConfig) Get

func (c *TConfig) Get(pattern string, def ...interface{}) interface{}

func (*TConfig) GetArray

func (c *TConfig) GetArray(pattern string, def ...interface{}) []interface{}

func (*TConfig) GetBool

func (c *TConfig) GetBool(pattern string, def ...interface{}) bool

func (*TConfig) GetDuration

func (c *TConfig) GetDuration(pattern string, def ...interface{}) time.Duration

func (*TConfig) GetFileName

func (c *TConfig) GetFileName() string

获取配置文件名

func (*TConfig) GetFilePath

func (c *TConfig) GetFilePath(file ...string) (path string)

获取配置文件路径

func (*TConfig) GetFloat32

func (c *TConfig) GetFloat32(pattern string, def ...interface{}) float32

func (*TConfig) GetFloat64

func (c *TConfig) GetFloat64(pattern string, def ...interface{}) float64

func (*TConfig) GetFloats

func (c *TConfig) GetFloats(pattern string, def ...interface{}) []float64

func (*TConfig) GetInt

func (c *TConfig) GetInt(pattern string, def ...interface{}) int

func (*TConfig) GetInt16

func (c *TConfig) GetInt16(pattern string, def ...interface{}) int16

func (*TConfig) GetInt32

func (c *TConfig) GetInt32(pattern string, def ...interface{}) int32

func (*TConfig) GetInt64

func (c *TConfig) GetInt64(pattern string, def ...interface{}) int64

func (*TConfig) GetInt8

func (c *TConfig) GetInt8(pattern string, def ...interface{}) int8

func (*TConfig) GetInterfaces

func (c *TConfig) GetInterfaces(pattern string, def ...interface{}) []interface{}

func (*TConfig) GetInts

func (c *TConfig) GetInts(pattern string, def ...interface{}) []int

func (*TConfig) GetMap

func (c *TConfig) GetMap(pattern string, def ...interface{}) map[string]interface{}

func (*TConfig) GetString

func (c *TConfig) GetString(pattern string, def ...interface{}) string

func (*TConfig) GetStrings

func (c *TConfig) GetStrings(pattern string, def ...interface{}) []string

func (*TConfig) GetStruct

func (c *TConfig) GetStruct(pattern string, pointer interface{}, mapping ...map[string]string) error

func (*TConfig) GetStructDeep

func (c *TConfig) GetStructDeep(pattern string, pointer interface{}, mapping ...map[string]string) error

func (*TConfig) GetStructs

func (c *TConfig) GetStructs(pattern string, pointer interface{}, mapping ...map[string]string) error

func (*TConfig) GetStructsDeep

func (c *TConfig) GetStructsDeep(pattern string, pointer interface{}, mapping ...map[string]string) error

func (*TConfig) GetTime

func (c *TConfig) GetTime(pattern string, format ...string) time.Time

func (*TConfig) GetUint

func (c *TConfig) GetUint(pattern string, def ...interface{}) uint

func (*TConfig) GetUint16

func (c *TConfig) GetUint16(pattern string, def ...interface{}) uint16

func (*TConfig) GetUint32

func (c *TConfig) GetUint32(pattern string, def ...interface{}) uint32

func (*TConfig) GetUint64

func (c *TConfig) GetUint64(pattern string, def ...interface{}) uint64

func (*TConfig) GetUint8

func (c *TConfig) GetUint8(pattern string, def ...interface{}) uint8

func (*TConfig) GetVar

func (c *TConfig) GetVar(pattern string, def ...interface{}) *_type.TVar

func (*TConfig) GetXTime

func (c *TConfig) GetXTime(pattern string, format ...string) *xtime.Time

func (*TConfig) SetFileName

func (c *TConfig) SetFileName(name string)

设置配置文件名

func (*TConfig) SetPath

func (c *TConfig) SetPath(path string) error

func (*TConfig) SetViolenceCheck

func (c *TConfig) SetViolenceCheck(check bool)

设置是否检查访问子层,默认false

Jump to

Keyboard shortcuts

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