config

package
v0.0.0-...-ab943b8 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Db     = "db"
	DbHost = "host"
	DbPort = "host"
	DbUser = "user"
	DbPass = "pass"
	DbName = "name"
)

Variables

View Source
var (
	ErrNoValue = errors.New("config error, no value") //没有对应的值
)

Functions

func Get

func Get(title string, key string) (string, error)

获取内容

func GetWithDef

func GetWithDef(title string, key string, def string) string

获取内容,如果不存在则返回默认值

func Load

func Load(filename string) error

Load 加载配置文件

func ToInt

func ToInt(str string, err error) (int, error)

转 int 输出

Types

type Ini

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

Ini 配置对象

func NewIni

func NewIni() *Ini

NewIni 创建新的配置对象

func (*Ini) Get

func (o *Ini) Get(title string, key string) (string, error)

获取内容

func (*Ini) GetWithDef

func (o *Ini) GetWithDef(title string, key string, def string) string

获取内容,如果不存在则返回默认值

func (*Ini) Load

func (o *Ini) Load(filename string) error

Jump to

Keyboard shortcuts

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