flagext

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LabelsToMetric

func LabelsToMetric(ls labels.Labels) model.Metric

LabelsToMetric converts a Labels to Metric Don't do this on any performance sensitive paths.

func MapToModelLabelSet

func MapToModelLabelSet(m map[string]string) model.LabelSet

MapToModelLabelSet converts a map into a model.LabelSet

func ModelLabelSetToMap

func ModelLabelSetToMap(m model.LabelSet) map[string]string

ModelLabelSetToMap convert a model.LabelSet to a map[string]string

func RoundToMilliseconds

func RoundToMilliseconds(from, through time.Time) (model.Time, model.Time)

RoundToMilliseconds returns milliseconds precision time from nanoseconds. from will be rounded down to the nearest milliseconds while through is rounded up.

Types

type ByteSize

type ByteSize uint64

ByteSize is a flag parsing compatibility type for constructing human friendly sizes. It implements flag.Value & flag.Getter.

func (ByteSize) Get

func (bs ByteSize) Get() interface{}

func (*ByteSize) MarshalJSON

func (bs *ByteSize) MarshalJSON() ([]byte, error)

Use a string representation for consistency

func (*ByteSize) MarshalYAML

func (bs *ByteSize) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaller. Use a string representation for consistency

func (*ByteSize) Set

func (bs *ByteSize) Set(s string) error

func (ByteSize) String

func (bs ByteSize) String() string

func (*ByteSize) UnmarshalJSON

func (bs *ByteSize) UnmarshalJSON(val []byte) error

UnmarshalJSON implements json.Unmarsal interface to work with JSON.

func (*ByteSize) UnmarshalYAML

func (bs *ByteSize) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML the Unmarshaler interface of the yaml pkg.

func (ByteSize) Val

func (bs ByteSize) Val() int

type LabelSet

type LabelSet struct {
	model.LabelSet `yaml:",inline"`
}

LabelSet is a labelSet that can be used as a flag.

func (LabelSet) MarshalYAML

func (v LabelSet) MarshalYAML() (interface{}, error)

MarshalYAML implements yaml.Marshaller.

func (*LabelSet) Set

func (v *LabelSet) Set(s string) error

Set implements flag.Value

func (LabelSet) String

func (v LabelSet) String() string

String implements flag.Value Format: a=1,b=2

func (*LabelSet) UnmarshalYAML

func (v *LabelSet) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML the Unmarshaler interface of the yaml pkg.

Jump to

Keyboard shortcuts

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