helper

package
v0.0.0-...-7578c0e Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCommandExecutionTimeout = errors.New("command execution timeout exceeded")

Functions

func FloatToIntRoundUP

func FloatToIntRoundUP(f float64) int

func GetEnv

func GetEnv(key string, dfault string, combineWith ...string) string

GetEnv retrieves the environment variable key. If it does not exist it returns the default.

func HostProc

func HostProc(combineWith ...string) string

func RoundToTwoDecimalPlaces

func RoundToTwoDecimalPlaces(v float64) float64

func RunCommandWithTimeout

func RunCommandWithTimeout(timeout time.Duration, name string, arg ...string) ([]byte, error)

RunCommandWithTimeout runs command and returns it's standard output. If timeout exceeded the returned error is ErrCommandExecutionTimeout

func StrInSlice

func StrInSlice(search string, slice []string) bool

StrInSlice returns true if search string found in slice

Types

type MeasurementsMap

type MeasurementsMap map[string]interface{}

func (MeasurementsMap) AddInnerWithPrefix

func (mm MeasurementsMap) AddInnerWithPrefix(prefix string, m MeasurementsMap) MeasurementsMap

func (MeasurementsMap) AddWithPrefix

func (mm MeasurementsMap) AddWithPrefix(prefix string, m MeasurementsMap) MeasurementsMap

func (MeasurementsMap) ToJSON

func (mm MeasurementsMap) ToJSON() string

type Timestamp

type Timestamp time.Time

Timestamp type allows marshaling time.Time struct as Unix timestamp value

func (*Timestamp) MarshalJSON

func (t *Timestamp) MarshalJSON() ([]byte, error)

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(raw []byte) error

Jump to

Keyboard shortcuts

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