Documentation ¶
Overview ¶
Package conv contains functions that help converting data between different types
Index ¶
- func Bool(in string) booldeprecated
- func Dict(v ...interface{}) (map[string]interface{}, error)
- func Has(in interface{}, key interface{}) bool
- func Join(in interface{}, sep string) (out string, err error)
- func MustAtoi(s string) int
- func MustParseFloat(s string, bitSize int) float64
- func MustParseInt(s string, base, bitSize int) int64
- func MustParseUint(s string, base, bitSize int) uint64
- func Slice(args ...interface{}) []interface{}deprecated
- func ToBool(in interface{}) bool
- func ToBools(in ...interface{}) []bool
- func ToFloat64(v interface{}) (float64, error)
- func ToFloat64s(in ...interface{}) ([]float64, error)
- func ToInt(in interface{}) (int, error)
- func ToInt64(v interface{}) (int64, error)
- func ToInt64s(in ...interface{}) ([]int64, error)
- func ToInts(in ...interface{}) ([]int, error)
- func ToString(in interface{}) string
- func ToStrings(in ...interface{}) []string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Dict ¶
Dict is a convenience function that creates a map with string keys. Provide arguments as key/value pairs. If an odd number of arguments is provided, the last is used as the key, and an empty string is set as the value. All keys are converted to strings, regardless of input type.
func Has ¶
func Has(in interface{}, key interface{}) bool
Has determines whether or not a given object has a property with the given key
func Join ¶
Join concatenates the elements of a to create a single string. The separator string sep is placed between elements in the resulting string.
This is functionally identical to strings.Join, except that each element is coerced to a string first
func MustParseFloat ¶
MustParseFloat - wrapper for strconv.ParseFloat that returns 0 in the case of error
func MustParseInt ¶
MustParseInt - wrapper for strconv.ParseInt that returns 0 in the case of error
func MustParseUint ¶
MustParseUint - wrapper for strconv.ParseUint that returns 0 in the case of error
func Slice
deprecated
func Slice(args ...interface{}) []interface{}
Slice creates a slice from a bunch of arguments
Deprecated: use github.com/hairyhenderson/gomplate/v4/coll.Slice instead
func ToBool ¶
func ToBool(in interface{}) bool
ToBool converts an arbitrary input into a boolean. Possible non-boolean true values are: 1 or the strings "t", "true", or "yes" (any capitalizations) All other values are considered false.
Types ¶
This section is empty.