xcast

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUnaddressable unaddressable val
	ErrUnaddressable = errors.New("val must be addressable")
	// ErrNotPointer pinter val
	ErrNotPointer = errors.New("val must be a pointer")
)

Functions

func Decode

func Decode(m interface{}, val interface{}) error

Decode decode interface into struct

func StringToDate

func StringToDate(s string) (time.Time, error)

StringToDate casts an empty interface to a time.Time.

func ToBool

func ToBool(i interface{}) bool

ToBool casts an empty interface to bool ignoring error

func ToBoolE

func ToBoolE(i interface{}) (bool, error)

ToBoolE casts an empty interface to a bool.

func ToDuration

func ToDuration(i interface{}) time.Duration

ToDuration casts an empty interface to duration ignoring error

func ToDurationE

func ToDurationE(i interface{}) (d time.Duration, err error)

ToDurationE casts an empty interface to time.Duration.

func ToFloat64

func ToFloat64(i interface{}) float64

ToFloat64 casts an empty interface to float64 ignoring error

func ToFloat64E

func ToFloat64E(i interface{}) (float64, error)

ToFloat64E casts an empty interface to a float64.

func ToInt

func ToInt(i interface{}) int

ToInt casts an empty interface to int ignoring error

func ToInt64

func ToInt64(i interface{}) int64

ToInt64 casts an empty interface to int64 ignoring error

func ToInt64E

func ToInt64E(i interface{}) (int64, error)

ToInt64E casts an empty interface to an int64.

func ToIntE

func ToIntE(i interface{}) (int, error)

ToIntE casts an empty interface to an int.

func ToIntSlice

func ToIntSlice(i interface{}) []int

ToIntSlice casts an empty interface to []int ignoring error

func ToIntSliceE

func ToIntSliceE(i interface{}) ([]int, error)

ToIntSliceE casts an empty interface to a []int.

func ToSlice

func ToSlice(i interface{}) []interface{}

ToSlice casts an empty interface []interface ignoring error

func ToSliceE

func ToSliceE(i interface{}) ([]interface{}, error)

ToSliceE casts an empty interface to a []interface{}.

func ToSliceStringMap

func ToSliceStringMap(i interface{}) []map[string]interface{}

ToSliceStringMap casts an empty interface to []map[string]interface{} ignoring error

func ToSliceStringMapE

func ToSliceStringMapE(i interface{}) ([]map[string]interface{}, error)

ToSliceStringMapE casts an empty interface to a []interface{}.

func ToString

func ToString(i interface{}) string

ToString casts an empty interface to string ignoring error

func ToStringE

func ToStringE(i interface{}) (string, error)

ToStringE casts an empty interface to a string.

func ToStringMap

func ToStringMap(i interface{}) map[string]interface{}

ToStringMap casts an empty interface to string map ignoring error

func ToStringMapBool

func ToStringMapBool(i interface{}) map[string]bool

ToStringMapBool casts an empty interface to map[string]bool ignoring error

func ToStringMapBoolE

func ToStringMapBoolE(i interface{}) (map[string]bool, error)

ToStringMapBoolE casts an empty interface to a map[string]bool.

func ToStringMapE

func ToStringMapE(i interface{}) (map[string]interface{}, error)

ToStringMapE casts an empty interface to a map[string]interface{}.

func ToStringMapString

func ToStringMapString(i interface{}) map[string]string

ToStringMapString casts an empty interface to map[string]string ignoring error

func ToStringMapStringE

func ToStringMapStringE(i interface{}) (map[string]string, error)

ToStringMapStringE casts an empty interface to a stringmap

func ToStringMapStringSlice

func ToStringMapStringSlice(i interface{}) map[string][]string

ToStringMapStringSlice casts an empty interface to map[string][]string ignoring error

func ToStringMapStringSliceE

func ToStringMapStringSliceE(i interface{}) (map[string][]string, error)

ToStringMapStringSliceE cast an empty interface to a string array map

func ToStringSlice

func ToStringSlice(i interface{}) []string

ToStringSlice casts an empty interface to []string ignoring error

func ToStringSliceE

func ToStringSliceE(i interface{}) ([]string, error)

ToStringSliceE casts an empty interface to a []string.

func ToTime

func ToTime(i interface{}) time.Time

ToTime casts an empty interface to time ignoring error

func ToTimeE

func ToTimeE(i interface{}) (tim time.Time, err error)

ToTimeE casts an empty interface to time.Time.

Types

This section is empty.

Jump to

Keyboard shortcuts

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