setting

package
v1.63.10 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrConfigNotSet       = errors.New("配置文件路径未设置")
	ErrConfigFileNotFound = errors.New("配置文件未找到")
	ErrConfigReadFailed   = errors.New("读取配置文件失败")
)

Functions

func NewSetting added in v1.63.4

func NewSetting(attrs ...SettingAttributes) (v *viper.Viper, err error)

Types

type AttrConfig

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

******************** 配置文件属性 ********************

func Content

func Content(content any) AttrConfig

func (AttrConfig) Register

func (my AttrConfig) Register(setting *Setting)

type AttrDefaultName added in v1.63.6

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

******************** 配置文件属性 ********************

func DefaultName added in v1.63.6

func DefaultName(name string) AttrDefaultName

func (AttrDefaultName) Register added in v1.63.6

func (my AttrDefaultName) Register(setting *Setting)

type AttrEnvName

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

******************** 配置文件属性 ********************

func EnvName

func EnvName(envName string) AttrEnvName

func (AttrEnvName) Register

func (my AttrEnvName) Register(setting *Setting)

type AttrFilename added in v1.63.6

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

******************** 配置文件属性 ********************

func Filename added in v1.63.6

func Filename(filename string) AttrFilename

func (AttrFilename) Register added in v1.63.6

func (my AttrFilename) Register(setting *Setting)

type AttrOnChange

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

******************** 配置文件属性 ********************

func OnChange

func OnChange(onChange func(v *viper.Viper, e fsnotify.Event)) AttrOnChange

func (AttrOnChange) Register

func (my AttrOnChange) Register(setting *Setting)

type Setting

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

******************** 配置文件 ******************** Setting

func (Setting) SetAttrs

func (my Setting) SetAttrs(attrs ...SettingAttributes) Setting

type SettingAttributes

type SettingAttributes interface{ Register(setting *Setting) }

******************** 配置文件属性 ********************

Jump to

Keyboard shortcuts

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