cfg

package
v0.0.0-...-9750751 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

package cfg implements functionalites for configuration

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Note: It is not thread/goroutine safe, and is intended to be used in places where it is goroutine/thread safety

func (*Config) GetConfig

func (c *Config) GetConfig(dotDelimitedKey string) (conf Config, err error)

GetConfig returns the config properties of a given key

func (*Config) GetValue

func (c *Config) GetValue(dotDelimitedKey string) interface{}

GetValue returns the assiciated value of the given dot-delimited key

func (*Config) Merge

func (c *Config) Merge(overrides *Config) error

Merge merges the properties from another Config When merging the properties, the keys are considered as case insensitive. The value for the same key will be overriden

func (*Config) ReadFrom

func (c *Config) ReadFrom(i interface{}) (err error)

ReadFrom reads configuration properties i, which pointing to a struct or a map

func (*Config) ReadFromToml

func (c *Config) ReadFromToml(r io.Reader) (err error)

ReadFromToml reads configuration properties in TOML format

func (*Config) ReadFromTomlBytes

func (c *Config) ReadFromTomlBytes(b []byte) (err error)

ReadFromTomlBytes reads configuration properties from byte array in TOML format

func (*Config) ReadFromTomlFile

func (c *Config) ReadFromTomlFile(file string) (err error)

ReadFromTomlFile reads configuration properties from a file in TOML format

func (*Config) SetKeyValue

func (c *Config) SetKeyValue(dotDelimitedKey string, v interface{})

SetKeyValue sets the value of a given key

func (*Config) WriteTo

func (c *Config) WriteTo(v interface{}) (err error)

WriteTo writes the configuration properties to a struct or map

func (*Config) WriteToKVList

func (c *Config) WriteToKVList(w io.Writer)

WriteToKVList writes the configuration properties as a dot-delimited-key value list

func (*Config) WriteToToml

func (c *Config) WriteToToml(w io.Writer) (err error)

WriteToToml writes the configuration properties in TOML format

Jump to

Keyboard shortcuts

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