Documentation
¶
Overview ¶
Package config 提供了对多种格式配置文件的支持
Index ¶
- type Manager
- func (mgr *Manager) AddUnmarshal(m UnmarshalFunc, ext ...string) error
- func (mgr *Manager) File(path string) string
- func (mgr *Manager) Load(r io.Reader, typ string, v interface{}) error
- func (mgr *Manager) LoadFile(path string, v interface{}) error
- func (mgr *Manager) SetUnmarshal(m UnmarshalFunc, ext ...string) error
- type Sanitizer
- type UnmarshalFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶ added in v0.18.0
type Manager struct {
// contains filtered or unexported fields
}
Manager 对 UnmarshalFunc 与扩展名的关联管理。
func NewManager ¶ added in v0.18.0
NewManager 新的 Manager 实例
func (*Manager) AddUnmarshal ¶ added in v0.18.0
func (mgr *Manager) AddUnmarshal(m UnmarshalFunc, ext ...string) error
AddUnmarshal 注册解析函数
func (*Manager) SetUnmarshal ¶ added in v0.18.0
func (mgr *Manager) SetUnmarshal(m UnmarshalFunc, ext ...string) error
SetUnmarshal 修改指定扩展名关联的解析函数,不存在则添加。
type Sanitizer ¶
type Sanitizer interface {
Sanitize() error
}
Sanitizer 如果对象实现了该方法,那么在解析完之后, 会调用该接口的函数对数据进行修正和检测。
type UnmarshalFunc ¶
UnmarshalFunc 定义了将文本内容解析到对象的函数原型。
Click to show internal directories.
Click to hide internal directories.