helper

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2017 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CastStringTimeFromSToMs

func CastStringTimeFromSToMs(time string) string

CastStringTimeFromSToMs adds three zeros to the timestring to cast from Seconds to Milliseconds.

func Contains added in v0.2.0

func Contains(hay []string, needles []string) bool

Contains checks if all values are within the list

func CopyMap

func CopyMap(old map[string]string) map[string]string

CopyMap creates a real copy of a string to string map.

func CreateJSONFromStringMap added in v0.2.0

func CreateJSONFromStringMap(input map[string]string) string

CreateJSONFromStringMap creates a part of a JSON object

func GenIndex added in v0.2.0

func GenIndex(index, timeString string) string

GenIndex generates an index depending on the config, ending with year and month

func GenJSONValueString added in v0.2.0

func GenJSONValueString(input string) string

GenJSONValueString quotes the string if it's not a number.

func GetYearMonthFromStringTimeMs added in v0.2.0

func GetYearMonthFromStringTimeMs(timeString string) (int, int)

GetYearMonthFromStringTimeMs returns the year and the month of a string which is in ms.

func IsStringANumber added in v0.2.0

func IsStringANumber(input string) bool

IsStringANumber returns true if the given string can be casted to int or float.

func PrintMapAsString

func PrintMapAsString(toPrint map[string]string, fieldSeparator, assignmentSeparator string) string

PrintMapAsString prints a map in the influxdb tags format.

func RequestedReturnCodeIsOK added in v0.2.0

func RequestedReturnCodeIsOK(client http.Client, url, function string) bool

RequestedReturnCodeIsOK makes an HEAD or GET request. If the returncode is 2XX it will return true.

func SPrintStringSlice added in v0.4.1

func SPrintStringSlice(slice []string) string

func SanitizeElasicInput added in v0.2.0

func SanitizeElasicInput(input string) string

SanitizeElasicInput escapes backslashes and trims single ticks.

func SanitizeInfluxInput

func SanitizeInfluxInput(input string) string

SanitizeInfluxInput adds backslashes to special chars.

func SanitizeMap added in v0.2.0

func SanitizeMap(input map[string]string) map[string]string

SanitizeMap calls SanitizeInfluxInput in key and value

func SentReturnCodeIsOK added in v0.2.0

func SentReturnCodeIsOK(client http.Client, url, function string, data string) (bool, string)

SentReturnCodeIsOK makes the given request. If the returncode is 2XX it will return true and the body else the error message.

func StringIntToStringFloat

func StringIntToStringFloat(inputInt string) string

StringIntToStringFloat adds a '.0' to a string if it does not contain a dot.

func StringToMap

func StringToMap(input, entrySplitter, keyValueSplitter string) map[string]string

StringToMap splits a string by two splitter an returns a map.

func SumIntSliceTillPos

func SumIntSliceTillPos(slice []int, pos int) int

SumIntSliceTillPos summarise an int slice till a given position.

func WaitForPort

func WaitForPort(typ, address string, timeout time.Duration) error

WaitForPort tries to connect to a server of returns with an error if no connection was made within the time

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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