Documentation ¶
Index ¶
- func LoadConfig() (err error)
- func LoadCustomConfig(receiver any, key string) (err error)
- func LoadCustomConfigWithKeys(receiver any, keys ...string) (err error)
- func LoadExternalConfig(receiver any, configFilePath string) (err error)
- func LoadExternalConfigWithKeys(receiver any, configFilePath string, keys ...string) (err error)
- func NewNoMatchedKeyError(key string) error
- type NoMatchedKeyError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LoadCustomConfigWithKeys ¶
LoadCustomConfigWithKeys 从默认配置文件中加载自定义配置,只加载指定的配置项,相当于多次调用 LoadCustomConfig
- receiver: 接收配置的结构体,需要使用指针
- keys: 配置项的键名,按层级顺序传入
func LoadExternalConfig ¶
LoadExternalConfig 加载外部配置文件
- receiver: 接收配置的结构体,需要使用指针
- configFilePath: 配置文件路径,不会检查文件是否存在
func LoadExternalConfigWithKeys ¶
LoadExternalConfigWithKeys 加载外部配置文件,只加载指定的配置项
- receiver: 接收配置的结构体,需要使用指针
- configFilePath: 配置文件路径,不会检查文件是否存在
- keys: 配置项的键名,按层级顺序传入
func NewNoMatchedKeyError ¶
Types ¶
type NoMatchedKeyError ¶
type NoMatchedKeyError struct {
// contains filtered or unexported fields
}
func (NoMatchedKeyError) Error ¶
func (e NoMatchedKeyError) Error() string
Click to show internal directories.
Click to hide internal directories.