Documentation ¶
Overview ¶
Package conv - easy and safe casting from one type to another.
CoreStore specific types have been additionally implemented for example in function ToStringE().
Functions ending with ...E() return an error which has always the bahaviour of not being valid.
Index ¶
- Variables
- func StringToDate(s string, loc *time.Location) (time.Time, error)
- func ToBool(i interface{}) bool
- func ToBoolE(i interface{}) (bool, error)
- func ToByte(i interface{}) []byte
- func ToByteE(i interface{}) ([]byte, error)
- func ToDuration(i interface{}) time.Duration
- func ToDurationE(i interface{}) (d time.Duration, err error)
- func ToFloat64(i interface{}) float64
- func ToFloat64E(i interface{}) (float64, error)
- func ToInt(i interface{}) int
- func ToInt64(i interface{}) int64
- func ToInt64E(i interface{}) (int64, error)
- func ToIntE(i interface{}) (int, error)
- func ToIntSlice(i interface{}) []int
- func ToIntSliceE(i interface{}) ([]int, error)
- func ToSlice(i interface{}) []interface{}
- func ToSliceE(i interface{}) ([]interface{}, error)
- func ToString(i interface{}) string
- func ToStringE(i interface{}) (string, error)
- func ToStringMap(i interface{}) map[string]interface{}
- func ToStringMapBool(i interface{}) map[string]bool
- func ToStringMapBoolE(i interface{}) (map[string]bool, error)
- func ToStringMapE(i interface{}) (map[string]interface{}, error)
- func ToStringMapString(i interface{}) map[string]string
- func ToStringMapStringE(i interface{}) (map[string]string, error)
- func ToStringMapStringSlice(i interface{}) map[string][]string
- func ToStringMapStringSliceE(i interface{}) (map[string][]string, error)
- func ToStringSlice(i interface{}) []string
- func ToStringSliceE(i interface{}) ([]string, error)
- func ToTime(i interface{}) time.Time
- func ToTimeE(i interface{}) (time.Time, error)
- func ToUint(i interface{}) uint
- func ToUintE(i interface{}) (uint, error)
Constants ¶
This section is empty.
Variables ¶
var TimeFormats = [...]string{ time.RFC3339, "2006-01-02T15:04:05", "2006-01-02 15:04:05", time.RFC1123Z, time.RFC1123, time.RFC822Z, time.RFC822, time.ANSIC, time.UnixDate, time.RubyDate, "2006-01-02 15:04:05Z07:00", "02 Jan 06 15:04 MST", "2006-01-02", "02 Jan 2006", "2006-01-02 15:04:05 -07:00", "2006-01-02 15:04:05 -0700", }
TimeFormats available time format to parse
Functions ¶
func StringToDate ¶
StringToDate casts an empty interface to a time.Time. Location can be nil, then time.Local is the default value.
func ToBoolE ¶
ToBoolE casts an empty interface to a bool. If a type implements function
ToBool() bool
this function will get called.
func ToByteE ¶
ToByteE casts an empty interface to a byte slice. Faster than ToStringE because ToByteE avoids some copying of data. Use wisely.
func ToDuration ¶
func ToDurationE ¶
ToDurationE casts an empty interface to time.Duration.
func ToFloat64E ¶
ToFloat64E casts an empty interface to a float64.
func ToIntSlice ¶
func ToIntSlice(i interface{}) []int
func ToIntSliceE ¶
ToIntSliceE casts an empty interface to a []int.
func ToSliceE ¶
func ToSliceE(i interface{}) ([]interface{}, error)
ToSliceE casts an empty interface to a []interface{}.
func ToStringMap ¶
func ToStringMap(i interface{}) map[string]interface{}
func ToStringMapBool ¶
func ToStringMapBoolE ¶
ToStringMapBoolE casts an empty interface to a map[string]bool.
func ToStringMapE ¶
ToStringMapE casts an empty interface to a map[string]interface{}.
func ToStringMapString ¶
func ToStringMapStringE ¶
ToStringMapStringE casts an empty interface to a map[string]string.
func ToStringMapStringSlice ¶
func ToStringMapStringSliceE ¶
ToStringMapStringSliceE casts an empty interface to a map[string][]string.
func ToStringSlice ¶
func ToStringSlice(i interface{}) []string
func ToStringSliceE ¶
ToStringSliceE casts an empty interface to a []string.
Types ¶
This section is empty.