helpers

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToStringMap

func ConvertToStringMap(data map[string]interface{}) (map[string]string, error)

convert a map[string]interface{} to a map[string]string by json encoding any non string fields

func EncryptValue

func EncryptValue(pgpKey, value string) (string, string, error)

func FormatJson

func FormatJson(body string) string

apply standard formatting to a json string by unmarshalling into a map then marshalling back to JSON

func GetNullProperties

func GetNullProperties(propertyMap map[string]interface{}) []string

func GetOldMapProperties

func GetOldMapProperties(old, new map[string]interface{}) []interface{}

get keys from old map not in new map

func InterfaceToString

func InterfaceToString(value interface{}) string

convert value to a string.

func InterfaceToStringOrYaml

func InterfaceToStringOrYaml(value interface{}) (string, error)

if the value is already a string return it, otherwise convert to the YAML representation

func JsonStringToMap

func JsonStringToMap(dataString string) (map[string]interface{}, error)

func MapToJsonString

func MapToJsonString(data map[string]interface{}) (string, error)

func MergeMaps

func MergeMaps(m1, m2 map[string]interface{})

func ParseYamlString

func ParseYamlString(value string) (interface{}, error)

parse given string in YAML format

func PropertyMapFromJson

func PropertyMapFromJson(body string) (map[string]string, error)

given a json representation of an object, build a map of the property names: property alias -> property path

func RemoveProperties

func RemoveProperties(properties []interface{}, excluded []string) []interface{}

given a list of items which may each be either a property or property map, remove the excluded properties

func RemovePropertiesFromMap

func RemovePropertiesFromMap(propertyMap map[string]string, excluded []string) map[string]string

given a property list, remove the excluded properties

func SliceContains

func SliceContains(s []string, searchTerm string) bool

no native contains in golang :/

func YamlStringsAreEqual

func YamlStringsAreEqual(yaml1, yaml2 string) (bool, error)

implements a equal operation on 2 YAML strings, ignoring formatting differences

Types

This section is empty.

Jump to

Keyboard shortcuts

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