goini

package
v0.0.0-...-01a1fb0 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RootPath   string
	ConfigFile string = "app.conf"
)

Functions

func AutoReload

func AutoReload(autoReload bool) func(*IniFile)

修改配置文件是否自动重载

func IsExist

func IsExist(key string) bool

func Keys

func Keys() []string

func OnReload

func OnReload(f func()) func(*IniFile)

配置文件自动重载后触发

func Sections

func Sections() []string

func SetLogger

func SetLogger(log *golog.Logger) func(*IniFile)

设置记录日志的函数

Types

type IniFile

type IniFile struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New(filepath string, options ...func(*IniFile)) *IniFile

func (*IniFile) Get

func (ini *IniFile) Get(key string, def ...interface{}) *Value

func (*IniFile) IsExist

func (ini *IniFile) IsExist(key string) bool

判断 key 是否存在

func (*IniFile) Keys

func (ini *IniFile) Keys() []string

返回配置文件的所有key

func (*IniFile) Sections

func (ini *IniFile) Sections() []string

返回配置文件的所有节点

type Value

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

func Get

func Get(key string, def ...interface{}) *Value

func GetDefault

func GetDefault(def ...interface{}) *Value

func NewValue

func NewValue(value string) *Value

func (*Value) Bool

func (v *Value) Bool() bool

func (*Value) Bytes

func (v *Value) Bytes() []byte

func (*Value) Duration

func (v *Value) Duration() time.Duration

func (*Value) Float32

func (v *Value) Float32() float32

func (*Value) Float64

func (v *Value) Float64() float64

func (*Value) Int

func (v *Value) Int() int

func (*Value) Int16

func (v *Value) Int16() int16

func (*Value) Int32

func (v *Value) Int32() int32

func (*Value) Int64

func (v *Value) Int64() int64

func (*Value) Int8

func (v *Value) Int8() int8

func (*Value) StrictBool

func (v *Value) StrictBool() (bool, error)

func (*Value) StrictDuration

func (v *Value) StrictDuration() (time.Duration, error)

Duration returns time.Duration type value.

func (*Value) StrictFloat32

func (v *Value) StrictFloat32() (float32, error)

func (*Value) StrictFloat64

func (v *Value) StrictFloat64() (float64, error)

func (*Value) StrictInt

func (v *Value) StrictInt() (int, error)

func (*Value) StrictInt16

func (v *Value) StrictInt16() (int16, error)

func (*Value) StrictInt32

func (v *Value) StrictInt32() (int32, error)

func (*Value) StrictInt64

func (v *Value) StrictInt64() (int64, error)

func (*Value) StrictInt8

func (v *Value) StrictInt8() (int8, error)

func (*Value) StrictTime

func (v *Value) StrictTime() (time.Time, error)

Time parses with RFC3339 format and returns time.Time type value.

func (*Value) StrictTimeFormat

func (v *Value) StrictTimeFormat(format string) (time.Time, error)

TimeFormat parses with given format and returns time.Time type value.

func (*Value) StrictUint

func (v *Value) StrictUint() (uint, error)

func (*Value) StrictUint16

func (v *Value) StrictUint16() (uint16, error)

func (*Value) StrictUint32

func (v *Value) StrictUint32() (uint32, error)

func (*Value) StrictUint64

func (v *Value) StrictUint64() (uint64, error)

func (*Value) StrictUint8

func (v *Value) StrictUint8() (uint8, error)

func (*Value) String

func (v *Value) String() string

func (*Value) Time

func (v *Value) Time() time.Time

func (*Value) TimeFormat

func (v *Value) TimeFormat(format string) time.Time

func (*Value) Uint

func (v *Value) Uint() uint

func (*Value) Uint16

func (v *Value) Uint16() uint16

func (*Value) Uint32

func (v *Value) Uint32() uint32

func (*Value) Uint64

func (v *Value) Uint64() uint64

func (*Value) Uint8

func (v *Value) Uint8() uint8

Jump to

Keyboard shortcuts

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