cfg

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 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 Unpack

func Unpack(properties CommonCfg, config interface{}) error

func UnpackAndDefaults

func UnpackAndDefaults(properties CommonCfg, config interface{}) error

func UnpackDefaultsAndValidate

func UnpackDefaultsAndValidate(properties CommonCfg, config interface{}) error

func UnpackFromEnvDefaultsAndValidate added in v1.1.0

func UnpackFromEnvDefaultsAndValidate(key string, config interface{}) error

func UnpackFromFile

func UnpackFromFile(path string, config interface{}) error

func UnpackFromFileDefaults

func UnpackFromFileDefaults(path string, config interface{}) error

func UnpackFromFileDefaultsAndValidate

func UnpackFromFileDefaultsAndValidate(path string, config interface{}) error

func UnpackRaw

func UnpackRaw(content []byte, config interface{}) error

func UnpackRawAndDefaults

func UnpackRawAndDefaults(content []byte, config interface{}) error

func UnpackRawDefaultsAndValidate

func UnpackRawDefaultsAndValidate(content []byte, config interface{}) error

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

func MergeCommonCfgListByType

func MergeCommonCfgListByType(base []CommonCfg, from []CommonCfg, override bool, ignoreFromType bool) []CommonCfg

MergeCommonCfgListByType merge commonCfg list ignoreFromType: set ignoreFromType=true, if fromCommonCfg had a type A which does not exist in baseCommonCfg, then type A would not merged to baseCommonCfg

func MergeCommonCfgListByTypeAndName

func MergeCommonCfgListByTypeAndName(base []CommonCfg, from []CommonCfg, override bool, ignoreFromType bool) []CommonCfg

func NewCommonCfg

func NewCommonCfg() CommonCfg

func Pack

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

func PackAndDefault

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

func (CommonCfg) Get

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

func (CommonCfg) GetName

func (c CommonCfg) GetName() string

func (CommonCfg) GetProperties

func (c CommonCfg) GetProperties() CommonCfg

TODO

func (CommonCfg) GetType

func (c CommonCfg) GetType() string

func (CommonCfg) Put

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

func (CommonCfg) Remove

func (c CommonCfg) Remove(key string)

func (CommonCfg) UID

func (c CommonCfg) UID() string

type ComponentBaseConfig

type ComponentBaseConfig struct {
	Enabled    *bool     `yaml:"enabled,omitempty"`
	Name       string    `yaml:"name,omitempty"`
	Type       string    `yaml:"type,omitempty" validate:"required"`
	Properties CommonCfg `yaml:",inline"`
}

type SystemConfig

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

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