conf

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config 封装程序操作ini配置文件的方法

func New

func New(configPath string) (cfg *Config, err error)

New 初始化Config结构体

func (Config) AllHash

func (c Config) AllHash() (data map[string]map[string]string)

AllHash 获取ini文件所有分区的经过解析的键值对

func (Config) BaseDir

func (c Config) BaseDir() string

BaseDir 获取base_dir(专项方法)

func (Config) DefaultBranch added in v1.3.0

func (c Config) DefaultBranch() string

func (Config) GetKey

func (c Config) GetKey(section, key string) string

GetKey 获取分区下某个键的值

func (Config) GetPath added in v1.2.0

func (c Config) GetPath(section, key string) (string, error)

GetPath 封装 GetKey 结果,如果值以 ~ 开头,替换为家目录

func (Config) MustKey

func (c Config) MustKey(section, key, defaults string) string

MustKey 获取分区下某个键的值,可设置默认值

func (Config) MustPath added in v1.4.0

func (c Config) MustPath(section, key, defaults string) string

MustPath 可设置默认值的 GetPath

func (Config) SecHash

func (c Config) SecHash(section string) (data map[string]string)

SecHash 获取ini文件某个分区下所有经过解析的键值对

Jump to

Keyboard shortcuts

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