Documentation
¶
Index ¶
- func AreSliceEqual(first []interface{}, second []interface{}) bool
- func AreStringSliceEqual(first []string, second []string) bool
- func ConvertToStringSlice(slice []interface{}, ignoreNil bool) []string
- func ExtractFieldFromMapList(data []map[string]interface{}, field string) []interface{}
- func PrettyPrintJSON(data []byte) error
- func SortStringSlice(slice []string, order SortOrder) []string
- type SortOrder
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AreSliceEqual ¶
func AreSliceEqual(first []interface{}, second []interface{}) bool
Checks to see if slices are equal to each other, returning false or true
func AreStringSliceEqual ¶
Checks to see if the string slices are equal to each other, returning false or true
func ConvertToStringSlice ¶
Converts a given interface{} slice into a []string
func ExtractFieldFromMapList ¶
Extracts a given field from n list of maps, returning a list f the values for that field, where the field does not exist, a nil is added
func PrettyPrintJSON ¶
Pretty prints JSON data
Example ¶
The PrettyPrintJSON function prints out JSON in a pretty format
type dataType struct { Foo string `json:"foo"` Jesus string `json:"Jesus"` Woo string `json:"Woo"` } data := dataType{ Foo: "bar", Jesus: "the LORD", Woo: "hoo", } dataAsJson, err := json.Marshal(data) if err != nil { log.Fatal("error marshalling the data: ", err) } PrettyPrintJSON(dataAsJson)
Output: { "foo": "bar", "Jesus": "the LORD", "Woo": "hoo" }
func SortStringSlice ¶
Sorts a given string slice in a given order
Types ¶
Click to show internal directories.
Click to hide internal directories.