config

package
v0.1.82 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2020 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(confName, ext, appName string) error

Init initialize config module with and accept confName that is config filename ext is config file extension appName is software name and will use to make search paths for config file config module will search for config files in flowing locations: /etc/<appName> $HOME/.<appName> and beside the executable file

func Load

func Load() error

Load configs and set variables can use to reload configs

Types

type Bool

type Bool interface {
	Bool() bool
}

Bool type interface

func RegisterBool

func RegisterBool(key string, defValue bool) Bool

RegisterBool register a bool variable

type Float

type Float interface {
	Float32() float32
	Float64() float64
}

Float type interface

func RegisterFloat32

func RegisterFloat32(key string, defValue float32) Float

RegisterFloat32 register a float32 variable

func RegisterFloat64

func RegisterFloat64(key string, defValue float64) Float

RegisterFloat64 register a float64 variable

type Int

type Int interface {
	Int() int
	Int64() int64
}

Int type interface

func RegisterInt

func RegisterInt(key string, defValue int) Int

RegisterInt register an integer variable

func RegisterInt64

func RegisterInt64(key string, defValue int64) Int

RegisterInt64 register an int64 variable

func RegisterIntMock

func RegisterIntMock(key string, defValue int) Int

RegisterIntMock mock register int

type String

type String interface {
	String() string
}

String type interface

func RegisterString

func RegisterString(key, defValue string) String

RegisterString register an string variable

func RegisterStringArrayMock added in v0.1.81

func RegisterStringArrayMock(key, defValue string) String

RegisterStringArrayMock mock register string array

func RegisterStringMock

func RegisterStringMock(key, defValue string) String

RegisterStringMock mock register string

type StringSlice added in v0.1.81

type StringSlice interface {
	Slice() []string
}

StringSlice type interface

func RegisterStringSlice added in v0.1.82

func RegisterStringSlice(key string, defValue []string) StringSlice

RegisterStringSlice register an string variable

Jump to

Keyboard shortcuts

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