config

package
v0.0.0-...-fa0c35c Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConfig

func LoadConfig() (err error)

LoadConfig 加载默认配置文件

func LoadCustomConfig

func LoadCustomConfig(receiver any, key string) (err error)

LoadCustomConfig 从默认配置文件中加载自定义配置

  • receiver: 接收配置的结构体,需要使用指针
  • key: 配置项的键名

func LoadCustomConfigWithKeys

func LoadCustomConfigWithKeys(receiver any, keys ...string) (err error)

LoadCustomConfigWithKeys 从默认配置文件中加载自定义配置,只加载指定的配置项,相当于多次调用 LoadCustomConfig

  • receiver: 接收配置的结构体,需要使用指针
  • keys: 配置项的键名,按层级顺序传入

func LoadExternalConfig

func LoadExternalConfig(receiver any, configFilePath string) (err error)

LoadExternalConfig 加载外部配置文件

  • receiver: 接收配置的结构体,需要使用指针
  • configFilePath: 配置文件路径,不会检查文件是否存在

func LoadExternalConfigWithKeys

func LoadExternalConfigWithKeys(receiver any, configFilePath string, keys ...string) (err error)

LoadExternalConfigWithKeys 加载外部配置文件,只加载指定的配置项

  • receiver: 接收配置的结构体,需要使用指针
  • configFilePath: 配置文件路径,不会检查文件是否存在
  • keys: 配置项的键名,按层级顺序传入

func NewNoMatchedKeyError

func NewNoMatchedKeyError(key string) error

Types

type NoMatchedKeyError

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

func (NoMatchedKeyError) Error

func (e NoMatchedKeyError) Error() string

Jump to

Keyboard shortcuts

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