config

package
v0.7.8 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConfigDir = func() string {
	return getGlobalConfig().ConfigDir()
}()

ConfigDir 配置目录(向后兼容变量) 注意:这是一个函数调用,返回配置目录路径 ConfigDir 配置目录(向后兼容变量) 注意:这是一个函数调用,返回配置目录路径

Functions

func Get

func Get(name, defaultValue string, alias ...string) string

Get 获取配置值(向后兼容接口) 使用全局配置实例,支持懒加载

Types

type Config

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

Config 配置管理器

func New

func New() (*Config, error)

New 创建新的配置管理器

func NewWithDir

func NewWithDir(dir string) (*Config, error)

NewWithDir 使用指定目录创建配置管理器

func (*Config) ConfigDir

func (c *Config) ConfigDir() string

ConfigDir 返回配置目录

func (*Config) Get

func (c *Config) Get(name, defaultValue string, alias ...string) string

Get 获取配置值

func (*Config) Save

func (c *Config) Save() error

Save 保存配置到文件

func (*Config) Set

func (c *Config) Set(name, value string)

Set 设置配置值(仅内存中)

Source Files

  • config.go
  • config_v2.go
  • doc.go

Jump to

Keyboard shortcuts

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