config

package
v1.0.4-preview.4 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2026 License: AGPL-3.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalConfig = NewConfigManager()

Functions

func ConfigToMap

func ConfigToMap(config interface{}) (map[string]string, error)

ConfigToMap 将配置对象转换为map(导出函数)

func UpdateConfigFromMap

func UpdateConfigFromMap(config interface{}, configMap map[string]string) error

UpdateConfigFromMap 从map更新配置对象(导出函数)

Types

type ConfigManager

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

ConfigManager 统一管理所有配置

func NewConfigManager

func NewConfigManager() *ConfigManager

func (*ConfigManager) ExportAllConfigs

func (cm *ConfigManager) ExportAllConfigs() map[string]string

ExportAllConfigs 导出所有已注册的配置为扁平结构

func (*ConfigManager) Get

func (cm *ConfigManager) Get(name string) interface{}

Get 获取指定配置模块

func (*ConfigManager) LoadFromDB

func (cm *ConfigManager) LoadFromDB(options map[string]string) error

LoadFromDB 从数据库加载配置

func (*ConfigManager) Register

func (cm *ConfigManager) Register(name string, config interface{})

Register 注册一个配置模块

func (*ConfigManager) SaveToDB

func (cm *ConfigManager) SaveToDB(updateFunc func(key, value string) error) error

SaveToDB 将配置保存到数据库

Jump to

Keyboard shortcuts

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