Documentation
¶
Index ¶
- type Creater
- type JsonLoader
- func (l *JsonLoader[T]) Get() *T
- func (l *JsonLoader[T]) GetSrc() []byte
- func (l *JsonLoader[T]) Load(src []byte, path string) error
- func (l *JsonLoader[T]) LoadBy(t *T) error
- func (l *JsonLoader[T]) LoadFile(path string) error
- func (l *JsonLoader[T]) RegHook(hook func(old, new *T))
- func (l *JsonLoader[T]) SaveFile(path string) error
- type JsonLoaders
- func (l *JsonLoaders[T]) Get() map[string]*T
- func (l *JsonLoaders[T]) GetItem(key string) *T
- func (l *JsonLoaders[T]) GetSrc() map[string][]byte
- func (l *JsonLoaders[T]) GetSrcItem(key string) []byte
- func (l *JsonLoaders[T]) Load(src map[string][]byte, path string) error
- func (l *JsonLoaders[T]) RegHook(hook func(old, new map[string]*T))
- func (l *JsonLoaders[T]) Set(confs map[string]*T)
- type Loader
- type Loaders
- type Normalizer
- type StrLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JsonLoader ¶
JsonLoader json配置加载对象 协程安全 如果T有成员函数Normalize, 会加载完配置后调用
func (*JsonLoader[T]) GetSrc ¶
func (l *JsonLoader[T]) GetSrc() []byte
func (*JsonLoader[T]) LoadBy ¶
func (l *JsonLoader[T]) LoadBy(t *T) error
func (*JsonLoader[T]) LoadFile ¶
func (l *JsonLoader[T]) LoadFile(path string) error
func (*JsonLoader[T]) RegHook ¶
func (l *JsonLoader[T]) RegHook(hook func(old, new *T))
RegHook 注册配置修改Hook
func (*JsonLoader[T]) SaveFile ¶
func (l *JsonLoader[T]) SaveFile(path string) error
type JsonLoaders ¶
JsonLoaders json配置加载对象 协程安全 如果T有成员函数Normalize, 会加载完配置后调用
func (*JsonLoaders[T]) Get ¶
func (l *JsonLoaders[T]) Get() map[string]*T
Get 返回的map对象一定不为nil 外层不需要再判断
func (*JsonLoaders[T]) GetItem ¶
func (l *JsonLoaders[T]) GetItem(key string) *T
GetItem 获取指定的配置,返回的对象可能会为nil
func (*JsonLoaders[T]) GetSrc ¶
func (l *JsonLoaders[T]) GetSrc() map[string][]byte
func (*JsonLoaders[T]) GetSrcItem ¶
func (l *JsonLoaders[T]) GetSrcItem(key string) []byte
func (*JsonLoaders[T]) Load ¶
func (l *JsonLoaders[T]) Load(src map[string][]byte, path string) error
func (*JsonLoaders[T]) RegHook ¶
func (l *JsonLoaders[T]) RegHook(hook func(old, new map[string]*T))
RegHook 注册配置修改Hook
type Loader ¶
type Loader interface { // 获取原始配置 返回nil表示未加载 GetSrc() []byte // 加载接口 src:原始配置数据 path:相关的路径 Load(src []byte, path string) error // 从本地文件加载 LoadFile(path string) error // 保存本地 SaveFile(path string) error }
ConfLoader 配置接口
type Loaders ¶
type Loaders interface { // 获取原始配置 nil表示未加载过 GetSrc() map[string][]byte // 获取原始配置 nil表示未加载过 GetSrcItem(key string) []byte // 加载接口 src:原始配置数据 path:相关的路径 Load(src map[string][]byte, path string) error }
Loaders 多配置接口
Click to show internal directories.
Click to hide internal directories.