conf

package
v0.0.0-...-653efa9 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfMap

type ConfMap map[string]ConfMapSection

func MakeConfMap

func MakeConfMap() (confMap ConfMap)

MakeConfMap returns an newly created empty ConfMap

func MakeConfMapFromFile

func MakeConfMapFromFile(confFilePath string) (confMap ConfMap, err error)

MakeConfMapFromFile returns a newly created ConfMap loaded with the contents of the confFilePath-specified file

func MakeConfMapFromStrings

func MakeConfMapFromStrings(confStrings []string) (confMap ConfMap, err error)

MakeConfMapFromStrings returns a newly created ConfMap loaded with the contents specified in confStrings

func (ConfMap) Dump

func (confMap ConfMap) Dump() (confMapString string)

Dump returns a single string that, if passed written to a file used as input to MakeConfMapFromFile() would result in an identical ConfMap.

To enable efficient comparisons, the elements of the ConfMap will be sorted in the output (both by sectionName and by optionName).

func (ConfMap) DumpConfMapToFile

func (confMap ConfMap) DumpConfMapToFile(confFilePath string, perm os.FileMode) (err error)

DumpConfMapToFile outputs the ConfMap to a confFilePath-specified file with the perm-specified os.FileMode

func (ConfMap) FetchOptionValueBase64String

func (confMap ConfMap) FetchOptionValueBase64String(sectionName string, optionName string) (optionValue string, err error)

FetchOptionValueBase64String returns [sectionName]optionName's single string value Base64-decoded

func (ConfMap) FetchOptionValueBase64StringSlice

func (confMap ConfMap) FetchOptionValueBase64StringSlice(sectionName string, optionName string) (optionValue []string, err error)

FetchOptionValueBase64StringSlice returns [sectionName]optionName's string values as a []string each element Base64-decoded

func (ConfMap) FetchOptionValueBool

func (confMap ConfMap) FetchOptionValueBool(sectionName string, optionName string) (optionValue bool, err error)

FetchOptionValueBool returns [sectionName]optionName's single string value converted to a bool

func (ConfMap) FetchOptionValueDuration

func (confMap ConfMap) FetchOptionValueDuration(sectionName string, optionName string) (optionValue time.Duration, err error)

FetchOptionValueDuration returns [sectionName]optionName's single string value converted to a time.Duration

func (ConfMap) FetchOptionValueFloat32

func (confMap ConfMap) FetchOptionValueFloat32(sectionName string, optionName string) (optionValue float32, err error)

FetchOptionValueFloat32 returns [sectionName]optionName's single string value converted to a float32

func (ConfMap) FetchOptionValueFloat64

func (confMap ConfMap) FetchOptionValueFloat64(sectionName string, optionName string) (optionValue float64, err error)

FetchOptionValueFloat64 returns [sectionName]optionName's single string value converted to a float32

func (ConfMap) FetchOptionValueFloatScaledToUint32

func (confMap ConfMap) FetchOptionValueFloatScaledToUint32(sectionName string, optionName string, multiplier uint32) (optionValue uint32, err error)

FetchOptionValueFloatScaledToUint32 returns [sectionName]optionName's single string value converted to a float64, multiplied by the uint32 multiplier, as a uint32

func (ConfMap) FetchOptionValueFloatScaledToUint64

func (confMap ConfMap) FetchOptionValueFloatScaledToUint64(sectionName string, optionName string, multiplier uint64) (optionValue uint64, err error)

FetchOptionValueFloatScaledToUint64 returns [sectionName]optionName's single string value converted to a float64, multiplied by the uint64 multiplier, as a uint64

func (ConfMap) FetchOptionValueString

func (confMap ConfMap) FetchOptionValueString(sectionName string, optionName string) (optionValue string, err error)

FetchOptionValueString returns [sectionName]optionName's single string value

func (ConfMap) FetchOptionValueStringSlice

func (confMap ConfMap) FetchOptionValueStringSlice(sectionName string, optionName string) (optionValue []string, err error)

FetchOptionValueStringSlice returns [sectionName]optionName's string values as a []string

func (ConfMap) FetchOptionValueUUID

func (confMap ConfMap) FetchOptionValueUUID(sectionName string, optionName string) (optionValue []byte, err error)

FetchOptionValueUUID returns [sectionName]optionName's single string value converted to a UUID ([16]byte)

From RFC 4122, a UUID string is defined as follows:

UUID                   = time-low "-" time-mid "-" time-high-and-version "-" clock-seq-and-reserved clock-seq-low "-" node
time-low               = 4hexOctet
time-mid               = 2hexOctet
time-high-and-version  = 2hexOctet
clock-seq-and-reserved = hexOctet
clock-seq-low          = hexOctet
node                   = 6hexOctet
hexOctet               = hexDigit hexDigit
hexDigit               = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / "a" / "b" / "c" / "d" / "e" / "f" / "A" / "B" / "C" / "D" / "E" / "F"

From RFC 4122, a UUID (i.e. "in memory") is defined as follows (BigEndian/NetworkByteOrder):

0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                          time_low                             |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|       time_mid                |         time_hi_and_version   |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|clk_seq_hi_res |  clk_seq_low  |         node (0-1)            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                         node (2-5)                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

func (ConfMap) FetchOptionValueUint16

func (confMap ConfMap) FetchOptionValueUint16(sectionName string, optionName string) (optionValue uint16, err error)

FetchOptionValueUint16 returns [sectionName]optionName's single string value converted to a uint16

func (ConfMap) FetchOptionValueUint32

func (confMap ConfMap) FetchOptionValueUint32(sectionName string, optionName string) (optionValue uint32, err error)

FetchOptionValueUint32 returns [sectionName]optionName's single string value converted to a uint32

func (ConfMap) FetchOptionValueUint64

func (confMap ConfMap) FetchOptionValueUint64(sectionName string, optionName string) (optionValue uint64, err error)

FetchOptionValueUint64 returns [sectionName]optionName's single string value converted to a uint64

func (ConfMap) FetchOptionValueUint8

func (confMap ConfMap) FetchOptionValueUint8(sectionName string, optionName string) (optionValue uint8, err error)

FetchOptionValueUint8 returns [sectionName]optionName's single string value converted to a uint8

func (ConfMap) UpdateFromFile

func (confMap ConfMap) UpdateFromFile(confFilePath string) (err error)

UpdateFromFile modifies a pre-existing ConfMap based on updates specified in confFilePath

func (ConfMap) UpdateFromString

func (confMap ConfMap) UpdateFromString(confString string) (err error)

UpdateFromString modifies a pre-existing ConfMap based on an update specified in confString (e.g., from an extra command-line argument)

func (ConfMap) UpdateFromStrings

func (confMap ConfMap) UpdateFromStrings(confStrings []string) (err error)

UpdateFromStrings modifies a pre-existing ConfMap based on an update specified in confStrings (e.g., from an extra command-line argument)

func (ConfMap) VerifyOptionIsMissing

func (confMap ConfMap) VerifyOptionIsMissing(sectionName string, optionName string) (err error)

VerifyOptionIsMissing returns an error if [sectionName]optionName exists

func (ConfMap) VerifyOptionValueIsEmpty

func (confMap ConfMap) VerifyOptionValueIsEmpty(sectionName string, optionName string) (err error)

VerifyOptionValueIsEmpty returns an error if [sectionName]optionName's value is not empty

type ConfMapOption

type ConfMapOption []string

type ConfMapSection

type ConfMapSection map[string]ConfMapOption

Jump to

Keyboard shortcuts

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