utils

package
v0.0.0-...-c092c37 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2021 License: MIT Imports: 9 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMapIsNotEmpty

func CheckMapIsNotEmpty(m map[string]string) error

CheckMapIsNotEmpty returns error if any key or value from map is empty.

func MD5Hash

func MD5Hash(text string) string

MD5Hash return MD5 hash of given string.

func MD5HashFromTime

func MD5HashFromTime(t time.Time) string

MD5HashFromTime return MD5 hash of given time. It used for generate event ID.

func ParsePath

func ParsePath(rawPath, defaultExtension, configProvider string) (endpoint, path, extension string, err error)

ParsePath parses given path for endpoint, path and extension. Example:

rawPath  : http://127.0.0.1:4001/config/hugo.json
endpoint : http://127.0.0.1:4001 or 127.0.0.1:4001 (for consul)
path     : /config/hugo.json or cut /v1/kv/ (for consul)
extension: json

If extension is not set, defaultExtension will be returned.

func ReplacePlaceholders

func ReplacePlaceholders(str, prefix, label, new string) string

ReplacePlaceholders replaces placeholders for given params:

s      - destination string
prefix - type of label: LABEL or ANNOTATION
label  - label/annotation name
new    - new value

func StringSliceContains

func StringSliceContains(slice []string, str string) bool

StringSliceContains check slice contains string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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