typeutils

package
v0.0.0-...-17c0c07 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2015 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

helps with type coercion and merging maps

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AreMapStringMapStringInterfacesEqual

func AreMapStringMapStringInterfacesEqual(a, b map[string]map[string]interface{}) bool

func AreMapsEqual

func AreMapsEqual(a, b map[string]interface{}) bool

func MergeMaps

func MergeMaps(high, low map[string]interface{}) map[string]interface{}

merge possibly-nested maps (first argument takes priority) note that lists are replaced, not merged

func MergeMapsStringMapStringInterface

func MergeMapsStringMapStringInterface(high, low map[string]map[string]interface{}) map[string]map[string]interface{}

merge nested maps (first argument takes priority) note that lists are replaced, not merged

func StringSliceCompare

func StringSliceCompare(a, b []string) int

this was taken from golang `bytes.Compare`.

func StringSliceContains

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

returns true if a slice contains given string

func StringSliceDel

func StringSliceDel(slice []string, value string) []string

deletes first occurence of a given string

func StringSliceDelAll

func StringSliceDelAll(slice []string, value string) []string

deletes all occurences of a given string

func StringSliceDelIndex

func StringSliceDelIndex(a []string, i int) []string

deletes a given index

func StringSliceEquals

func StringSliceEquals(a, b []string) bool

func StringSlicePos

func StringSlicePos(slice []string, value string) int

returns first index of a given string

func ToBool

func ToBool(v interface{}, k string) (bool, error)

coerce interface{} to bool

func ToFloat64

func ToFloat64(v interface{}, k string) (float64, error)

coerce interface{} to float64

func ToInt

func ToInt(v interface{}, k string) (int, error)

coerce interface{} to int

func ToMap

func ToMap(v interface{}, k string) (map[string]interface{}, error)

coerce interface{} to map[string]interface{}

func ToMapStringMapStringInterface

func ToMapStringMapStringInterface(v interface{}, k string) (map[string]map[string]interface{}, error)

coerce interface{} to map[string]map[string]interface{}

func ToString

func ToString(v interface{}, k string) (string, error)

coerce interface{} to string.

func ToStringSlice

func ToStringSlice(v interface{}, k string) ([]string, error)

coerce interface{} to slice of strings.

Types

This section is empty.

Jump to

Keyboard shortcuts

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