Documentation ¶
Index ¶
- Constants
- Variables
- func Init(opts ...Option)
- func Load(fileName ...string) error
- func Register(cfg IConfig)
- func Unregister(cfg IConfig)
- type Config
- func (self *Config) Core() *core
- func (self *Config) GetBool(field string, defaultValue bool) bool
- func (self *Config) GetDuration(field string, defaultValue time.Duration) time.Duration
- func (self *Config) GetFloat64(field string, defaultValue float64) float64
- func (self *Config) GetInt(field string, defaultValue int) int
- func (self *Config) GetInt32(field string, defaultValue int32) int32
- func (self *Config) GetInt64(field string, defaultValue int64) int64
- func (self *Config) GetIntSlice(field string, defaultValue []int) []int
- func (self *Config) GetString(field, defaultValue string) string
- func (self *Config) GetTime(field string, defaultValue time.Time) time.Time
- func (self *Config) InConfig(path string) bool
- func (self *Config) Init(opts ...Option)
- func (self *Config) LoadFromFile(fileName ...string) error
- func (self *Config) LoadToModel(model IConfig) error
- func (self *Config) Register(cfg IConfig)
- func (self *Config) Reload()
- func (self *Config) SaveFromModel(model IConfig, immed ...bool) error
- func (self *Config) SaveToFile(opts ...Option) error
- func (self *Config) SetValue(field string, value interface{})
- func (self *Config) Unregister(cfg IConfig)
- type IConfig
- type ModeType
- type Option
Constants ¶
View Source
const ( CONFIG_FILE_NAME = "config.json" DEFAULT_PREFIX = "volts" MODE_NORMAL ModeType = iota MODE_DEBUG )
Variables ¶
Functions ¶
func Unregister ¶
func Unregister(cfg IConfig)
Types ¶
type Config ¶
type Config struct { //name string //fmt *format //models sync.Map AutoCreateFile bool `field:"-"` //Mode ModeType //FileName string Debug bool // contains filtered or unexported fields }
func (*Config) GetDuration ¶
func (*Config) GetFloat64 ¶
func (*Config) GetIntSlice ¶
func (*Config) LoadFromFile ¶
func (*Config) LoadToModel ¶
func (*Config) SaveFromModel ¶
从数据类型加载数据 只支持map[string]any 和struct
func (*Config) SaveToFile ¶
func (*Config) Unregister ¶
Click to show internal directories.
Click to hide internal directories.