dimensions

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 2 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dimension

type Dimension struct {
	Key   string
	Value string
}

Dimension is a key-value pair mapping string to string.

func NewDimension

func NewDimension(key, val string) Dimension

type NormalizedDimensionList

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

NormalizedDimensionList is a holder structure, containing normalized but not necessarily unique Dimension key-value pairs.

func MergeLists

func MergeLists(normalizedDimensionLists ...NormalizedDimensionList) NormalizedDimensionList

MergeLists combines one or more NormalizedDimensionList instances into one. Dimensions in sets passed further to the right but containing the same keys as sets further to the left will overwrite the values. The resulting set contains no duplicate keys. If duplicate keys appear in different sets, the value of the resulting set will be the one from the last set passed to this function and containing the key. The order of keys in the resulting set is not guaranteed.

func NewNormalizedDimensionList

func NewNormalizedDimensionList(dims ...Dimension) NormalizedDimensionList

NewNormalizedDimensionList creates a new Dimension set. All dimensions in the set are normalized, but it mights still contain duplicate keys. Dimensions with invalid keys (after normalization) are dropped.

func (NormalizedDimensionList) Format

func (ds NormalizedDimensionList) Format(formatter func([]Dimension) string) string

pass a function that transforms a slice of dimensions to a string. That way, the code for the actual serialization can be stored in the serialization package without exporting the dimensions in normalized dimensions which in turn restricts manipulation of already normalized values.

Jump to

Keyboard shortcuts

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