config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindArgs

func BindArgs(cmd *cobra.Command)

BindArgs binds command line arguments to config

func GetStruct

func GetStruct(path string, value interface{}) error

GetStruct gets Struct object by path in config

func GetStructWithValidation

func GetStructWithValidation(path string, value interface{}) error

GetStructWithValidation gets Struct object by path in config with validation

func InitConfig

func InitConfig() error

InitConfig loads config from config path

Types

type AgolloZerologAdapter

type AgolloZerologAdapter struct {
}

func (*AgolloZerologAdapter) Log

func (l *AgolloZerologAdapter) Log(kvs ...interface{})

type StringMap

type StringMap map[string]interface{}

StringMap defines config map type

func GetStringMap

func GetStringMap(path string) StringMap

GetStringMap gets StringMap object by path in config

func (StringMap) GetBool

func (m StringMap) GetBool(path string) (bool, error)

GetBool returns an bool value of config by path

func (StringMap) GetInt

func (m StringMap) GetInt(path string) (int, error)

GetInt returns an int value of config by path

func (StringMap) GetInt64

func (m StringMap) GetInt64(path string) (int64, error)

GetInt64 returns an int value of config by path

func (StringMap) GetString

func (m StringMap) GetString(path string) (string, error)

GetString returns a string value of config by path

func (StringMap) GetStringMap

func (m StringMap) GetStringMap(path string) (StringMap, error)

GetStringMap returns a map value of config by path

func (StringMap) GetStringMapList

func (m StringMap) GetStringMapList(path string) ([]StringMap, error)

GetStringMapList returns a list value of config by path

func (StringMap) GetStruct

func (m StringMap) GetStruct(path string, value interface{}) error

GetStruct returns a struct value of config by path

func (StringMap) GetStructWithValidation

func (m StringMap) GetStructWithValidation(path string, value interface{}) error

GetStructWithValidation returns a struct value of config by path with validation

func (StringMap) Mix

func (m StringMap) Mix(src StringMap)

Mix mixes in src config to dst config, overriding collisions in dst config map

func (StringMap) ToRawMap

func (m StringMap) ToRawMap() map[string]interface{}

ToRawMap converts config to raw map[string]interface{}

func (StringMap) ToStruct

func (m StringMap) ToStruct(targetObj interface{}) error

ToStruct converts config to generic interface, copying all config values

func (StringMap) ToStructWithValidation

func (m StringMap) ToStructWithValidation(targetObj interface{}) error

ToStructWithValidation converts config object to config map with field values validation

type TypeAssertionError

type TypeAssertionError struct {
	Value      interface{}
	TargetType string
}

TypeAssertionError describes type assertion error, used to generate type convertion errors

func (TypeAssertionError) Error

func (e TypeAssertionError) Error() string

Error returns type convertion error

Jump to

Keyboard shortcuts

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