cfg

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeCommonMap added in v1.2.0

func MergeCommonMap(base map[interface{}]interface{}, from map[interface{}]interface{}, override bool) map[interface{}]interface{}

func UnpackTypeDefaultsAndValidate added in v1.1.0

func UnpackTypeDefaultsAndValidate(configType string, key string, config interface{})

Types

type CommonCfg

type CommonCfg map[string]interface{}

func MergeCommonCfg

func MergeCommonCfg(base CommonCfg, from CommonCfg, override bool) CommonCfg

MergeCommonCfg merge `base` map with `from` map

func NewCommonCfg

func NewCommonCfg() CommonCfg

func Pack

func Pack(config interface{}) (CommonCfg, error)

func (CommonCfg) DeepCopy added in v1.3.0

func (c CommonCfg) DeepCopy() CommonCfg

func (CommonCfg) Get

func (c CommonCfg) Get(key string) interface{}

func (CommonCfg) Put

func (c CommonCfg) Put(key string, val interface{})

func (CommonCfg) Remove

func (c CommonCfg) Remove(key string)

type SystemConfig

type SystemConfig struct {
	DbFile string `yaml:"db_file" default:"./data/loggie.db"`
}

type UnPack added in v1.3.0

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

func NewUnpack added in v1.3.0

func NewUnpack(raw []byte, config interface{}, err error) *UnPack

func UnPackFromFile added in v1.3.0

func UnPackFromFile(path string, config interface{}) *UnPack

UnPackFromFile create an Unpack struct from file

func UnPackFromRaw added in v1.3.0

func UnPackFromRaw(raw []byte, config interface{}) *UnPack

UnPackFromRaw create an Unpack struct from bytes array

func UnpackFromCommonCfg added in v1.3.0

func UnpackFromCommonCfg(c CommonCfg, config interface{}) *UnPack

UnpackFromCommonCfg create an Unpack struct from CommonCfg

func UnpackFromEnv added in v1.3.0

func UnpackFromEnv(key string, config interface{}) *UnPack

UnpackFromEnv create an Unpack struct from env

func (*UnPack) Contents added in v1.3.0

func (u *UnPack) Contents() []byte

func (*UnPack) Defaults added in v1.3.0

func (u *UnPack) Defaults() *UnPack

func (*UnPack) Do added in v1.3.0

func (u *UnPack) Do() error

Do return the error

func (*UnPack) Validate added in v1.3.0

func (u *UnPack) Validate() *UnPack

type Validator

type Validator interface {
	Validate() error
}

Jump to

Keyboard shortcuts

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