preferences

package
v0.2.76 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddWatch

func AddWatch(event func(e fsnotify.Event))

func All

func All() map[string]any

All returns all loaded settings.

func GenerateConfig added in v0.0.4

func GenerateConfig() ([]byte, error)

func Get

func Get(path string, defaultValue ...any) string

Get returns a string setting and supports dot-separated paths.

func GetBool

func GetBool(path string, defaultValue ...any) bool

GetBool returns a bool setting.

func GetFloat64

func GetFloat64(path string, defaultValue ...any) float64

GetFloat64 returns a float64 setting.

func GetInt

func GetInt(path string, defaultValue ...any) int

GetInt returns an int setting.

func GetInt64

func GetInt64(path string, defaultValue ...any) int64

GetInt64 returns an int64 setting.

func GetIntSlice

func GetIntSlice(path string) []int

GetIntSlice returns an int slice setting.

func GetString

func GetString(path string, defaultValue ...any) string

GetString returns a string setting.

func GetStringMapString

func GetStringMapString(path string) map[string]string

GetStringMapString returns a string map setting.

func GetStringSlice

func GetStringSlice(path string) []string

GetStringSlice returns a string slice setting.

func GetUint

func GetUint(path string, defaultValue ...any) uint

GetUint returns a uint setting.

func IsSet added in v0.2.1

func IsSet(path string) bool

func IsTestMode added in v0.2.49

func IsTestMode() bool

func OpenConfigChangeEvent

func OpenConfigChangeEvent()

OpenConfigChangeEvent 开启监控配置文件⌚️

func Set added in v0.2.9

func Set(path string, value any)

Types

type ExclusivePreferences

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

ExclusivePreferences reads settings below a fixed root path.

func GetExclusivePreferences

func GetExclusivePreferences(prefix string) ExclusivePreferences

GetExclusivePreferences returns a namespaced preferences reader.

func (*ExclusivePreferences) Get

func (itself *ExclusivePreferences) Get(path string, defaultValue ...any) string

Get returns a string setting below the namespace.

func (*ExclusivePreferences) GetBool

func (itself *ExclusivePreferences) GetBool(path string, defaultValue ...any) bool

GetBool returns a bool setting below the namespace.

func (*ExclusivePreferences) GetFloat64

func (itself *ExclusivePreferences) GetFloat64(path string, defaultValue ...any) float64

GetFloat64 returns a float64 setting below the namespace.

func (*ExclusivePreferences) GetInt

func (itself *ExclusivePreferences) GetInt(path string, defaultValue ...any) int

GetInt returns an int setting below the namespace.

func (*ExclusivePreferences) GetInt64

func (itself *ExclusivePreferences) GetInt64(path string, defaultValue ...any) int64

GetInt64 returns an int64 setting below the namespace.

func (*ExclusivePreferences) GetString

func (itself *ExclusivePreferences) GetString(path string, defaultValue ...any) string

GetString returns a string setting below the namespace.

func (*ExclusivePreferences) GetStringMapString

func (itself *ExclusivePreferences) GetStringMapString(path string) map[string]string

GetStringMapString returns a string map setting below the namespace.

func (*ExclusivePreferences) GetUint

func (itself *ExclusivePreferences) GetUint(path string, defaultValue ...any) uint

GetUint returns a uint setting below the namespace.

Jump to

Keyboard shortcuts

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