utils

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArrayToString

func ArrayToString(array []string, sep string) string

func DoHttpRequest

func DoHttpRequest(ctx context.Context, client *http.Client, request *http.Request) ([]byte, error)

func FilterAlerts

func FilterAlerts(data template.Data, selector *v1.LabelSelector, logger log.Logger) template.Data

FilterAlerts filter the alerts with label selector,if the selector is not correct, return all of the alerts.

func JsonDecode

func JsonDecode(reader io.Reader, v interface{}) error

func JsonEncode

func JsonEncode(writer io.Writer, v interface{}) error

func JsonMarshal

func JsonMarshal(v interface{}) ([]byte, error)

func JsonMarshalIndent

func JsonMarshalIndent(v interface{}, prefix, indent string) ([]byte, error)

func JsonUnmarshal

func JsonUnmarshal(data []byte, v interface{}) error

func KvToLabelSet

func KvToLabelSet(obj template.KV) model.LabelSet

func MapToStruct

func MapToStruct(mv map[string]interface{}, v interface{}) error

func Md5key

func Md5key(val interface{}) (string, error)

func StringIsNil

func StringIsNil(s string) bool

func UrlWithParameters

func UrlWithParameters(u string, parameters map[string]string) (string, error)

func UrlWithPath

func UrlWithPath(u, path string) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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