utils

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// define custom errors for config map
	ErrKeyNotFound = errors.New("cannot find specified key in mapped values")
)

Functions

This section is empty.

Types

type ConfigMap

type ConfigMap struct {
	ValueMaps map[string]string
}

func NewConfigMap

func NewConfigMap() *ConfigMap

function to create a new config map

func NewConfigMapWithValues

func NewConfigMapWithValues(defaults map[string]string) *ConfigMap

function to create new config map with a collection of defaults

func (*ConfigMap) ConfigureLogging

func (cfg *ConfigMap) ConfigureLogging()

function used to configure log level in application

func (*ConfigMap) Get

func (cfg *ConfigMap) Get(key string) string

function used to retrieve mappings. environment variables override hard coded defaults

func (*ConfigMap) MustGet

func (cfg *ConfigMap) MustGet(key string) (string, error)

function used to retrieve mappings. environment variables override hard coded defaults. error is returned if no value is set

func (*ConfigMap) Set

func (cfg *ConfigMap) Set(key string, defaultVal string)

function used to set a default value for a given key

Jump to

Keyboard shortcuts

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