conf

package
v0.0.0-...-69d094b Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ErrParseOptions 标志配置不合法
	ErrParseOptions = E("parse options error")
	// ErrReadFile 表示读取文件失败
	ErrReadFile = E("read file error")
	// ErrFileNotExist 表示配置文件不存在
	ErrFileNotExist = E("file not exist")
	// ErrTarget 表示解析配置的目标错误
	ErrTarget = E("illegal target")
	// ErrWriteToFile 写文件错误
	ErrWriteToFile = E("write to file error")
	// ErrUnmarshal 反序列化错误
	ErrUnmarshal = E("unmarshal error")
)

Variables

This section is empty.

Functions

func Load

func Load(tgt interface{}, opts ...Option) error

Load 加载配置

Types

type E

type E string

E 表示错误类型

func (E) Error

func (e E) Error() string

Error 实现 error 接口

type Option

type Option interface {
	// contains filtered or unexported methods
}

Option 表示配置选项,只能内部生成

func OptCreateIfNotExist

func OptCreateIfNotExist(b bool) Option

OptCreateIfNotExist 当配置文件不存在时,是否需要生成默认配置

func OptFileName

func OptFileName(filename string) Option

OptFileName 返回一个可选的配置文件名选项

func OptFormat

func OptFormat(format string) Option

OptFormat 返回一个可选的文件格式。目前只支持 JSON

Jump to

Keyboard shortcuts

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