Documentation ¶
Index ¶
- Variables
- func BytesToString(b []byte) string
- func StringToBytes(s string) []byte
- func StringToDate(s string) (time.Time, error)
- func StringToDateInDefaultLocation(s string, location *time.Location) (time.Time, error)
- func ToBool(i interface{}) bool
- func ToBoolE(i interface{}) (bool, error)
- func ToBoolSlice(i interface{}) []bool
- func ToBoolSliceE(i interface{}) ([]bool, error)
- func ToDuration(i interface{}) time.Duration
- func ToDurationE(i interface{}) (d time.Duration, err error)
- func ToDurationSlice(i interface{}) []time.Duration
- func ToDurationSliceE(i interface{}) ([]time.Duration, error)
- func ToFloat[N constraints.Float](i any) N
- func ToFloat32(i any) float32
- func ToFloat32E(i any) (float32, error)
- func ToFloat64(i any) float64
- func ToFloat64E(i any) (float64, error)
- func ToFloatE[N constraints.Float](i any) (N, error)
- func ToInt(i any) int
- func ToInt16(i any) int16
- func ToInt16E(i any) (int16, error)
- func ToInt32(i any) int32
- func ToInt32E(i any) (int32, error)
- func ToInt32Slice(i interface{}) []int32
- func ToInt32SliceE(i interface{}) ([]int32, error)
- func ToInt64(i any) int64
- func ToInt64E(i any) (int64, error)
- func ToInt64Slice(i interface{}) []int64
- func ToInt64SliceE(i interface{}) ([]int64, error)
- func ToInt8(i any) int8
- func ToInt8E(i any) (int8, error)
- func ToIntE(i any) (int, error)
- func ToIntSlice(i interface{}) []int
- func ToIntSliceE(i interface{}) ([]int, error)
- func ToSigned[N constraints.Signed](i any) N
- func ToSignedE[N constraints.Signed](i any) (N, 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 ToStringMapInt(i interface{}) map[string]int
- func ToStringMapInt64(i interface{}) map[string]int64
- func ToStringMapInt64E(i interface{}) (map[string]int64, error)
- func ToStringMapIntE(i interface{}) (map[string]int, 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{}) (tim time.Time, err error)
- func ToTimeInDefaultLocation(i interface{}, location *time.Location) time.Time
- func ToTimeInDefaultLocationE(i interface{}, location *time.Location) (tim time.Time, err error)
- func ToUint(i any) uint
- func ToUint16(i any) uint16
- func ToUint16E(i any) (uint16, error)
- func ToUint32(i any) uint32
- func ToUint32E(i any) (uint32, error)
- func ToUint32Slice(i interface{}) []uint32
- func ToUint32SliceE(i interface{}) ([]uint32, error)
- func ToUint64(i any) uint64
- func ToUint64E(i any) (uint64, error)
- func ToUint64Slice(i interface{}) []uint64
- func ToUint64SliceE(i interface{}) ([]uint64, error)
- func ToUint8(i any) uint8
- func ToUint8E(i any) (uint8, error)
- func ToUintE(i any) (uint, error)
- func ToUintSlice(i interface{}) []uint
- func ToUintSliceE(i interface{}) ([]uint, error)
- func ToUnsigned[N constraints.Unsigned](i any) N
- func ToUnsignedE[N constraints.Unsigned](i any) (N, error)
Constants ¶
This section is empty.
Variables ¶
var ( ErrValueIsNULL = errors.New("convx: unable to convert NULL value") ErrNegativeNotAllowed = errors.New("convx: unable to convert negative value") )
Functions ¶
func BytesToString ¶
BytesToString converts byte slice to string without a memory allocation. For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.
func StringToBytes ¶
StringToBytes converts string to byte slice without a memory allocation. For more details, see https://github.com/golang/go/issues/53003#issuecomment-1140276077.
func StringToDate ¶
StringToDate attempts to parse a string into a time.Time type using a predefined list of formats. If no suitable format is found, an error is returned.
func StringToDateInDefaultLocation ¶
StringToDateInDefaultLocation casts an empty interface to a time.Time, interpreting inputs without a timezone to be in the given location, or the local timezone if nil.
func ToBoolSlice ¶
func ToBoolSlice(i interface{}) []bool
ToBoolSlice casts an interface to a []bool type.
func ToBoolSliceE ¶
ToBoolSliceE casts an interface to a []bool type.
func ToDuration ¶
ToDuration casts an interface to a time.Duration type.
func ToDurationE ¶
ToDurationE casts an interface to a time.Duration type.
func ToDurationSlice ¶
ToDurationSlice casts an interface to a []time.Duration type.
func ToDurationSliceE ¶
ToDurationSliceE casts an interface to a []time.Duration type.
func ToFloat ¶
func ToFloat[N constraints.Float](i any) N
ToFloat converts an interface to a floating-point type.
func ToFloat32E ¶
ToFloat32E casts an interface to a float32 type.
func ToFloat64E ¶
ToFloat64E casts an interface to a float64 type.
func ToFloatE ¶
func ToFloatE[N constraints.Float](i any) (N, error)
ToFloatE converts an interface to a floating-point type.
func ToInt32Slice ¶
func ToInt32Slice(i interface{}) []int32
ToInt32Slice casts an interface to a []int32 type.
func ToInt32SliceE ¶
ToInt32SliceE casts an interface to a []int32 type.
func ToInt64Slice ¶
func ToInt64Slice(i interface{}) []int64
ToInt64Slice casts an interface to a []int64 type.
func ToInt64SliceE ¶
ToInt64SliceE casts an interface to a []int64 type.
func ToIntSlice ¶
func ToIntSlice(i interface{}) []int
ToIntSlice casts an interface to a []int type.
func ToIntSliceE ¶
ToIntSliceE casts an interface to a []int type.
func ToSigned ¶
func ToSigned[N constraints.Signed](i any) N
ToSigned converts an interface to a signed integer type.
func ToSignedE ¶
func ToSignedE[N constraints.Signed](i any) (N, error)
ToSignedE converts an interface to a signed integer type.
func ToSlice ¶
func ToSlice(i interface{}) []interface{}
ToSlice casts an interface to a []interface{} type.
func ToSliceE ¶
func ToSliceE(i interface{}) ([]interface{}, error)
ToSliceE casts an interface to a []interface{} type.
func ToStringMap ¶
func ToStringMap(i interface{}) map[string]interface{}
ToStringMap casts an interface to a map[string]interface{} type.
func ToStringMapBool ¶
ToStringMapBool casts an interface to a map[string]bool type.
func ToStringMapBoolE ¶
ToStringMapBoolE casts an interface to a map[string]bool type.
func ToStringMapE ¶
ToStringMapE casts an interface to a map[string]interface{} type.
func ToStringMapInt ¶
ToStringMapInt casts an interface to a map[string]int type.
func ToStringMapInt64 ¶
ToStringMapInt64 casts an interface to a map[string]int64 type.
func ToStringMapInt64E ¶
ToStringMapInt64E casts an interface to a map[string]int64{} type.
func ToStringMapIntE ¶
ToStringMapIntE casts an interface to a map[string]int{} type.
func ToStringMapString ¶
ToStringMapString casts an interface to a map[string]string type.
func ToStringMapStringE ¶
ToStringMapStringE casts an interface to a map[string]string type.
func ToStringMapStringSlice ¶
ToStringMapStringSlice casts an interface to a map[string][]string type.
func ToStringMapStringSliceE ¶
ToStringMapStringSliceE casts an interface to a map[string][]string type.
func ToStringSlice ¶
func ToStringSlice(i interface{}) []string
ToStringSlice casts an interface to a []string type.
func ToStringSliceE ¶
ToStringSliceE casts an interface to a []string type.
func ToTimeInDefaultLocation ¶
func ToTimeInDefaultLocationE ¶
ToTimeInDefaultLocationE casts an empty interface to time.Time, interpreting inputs without a timezone to be in the given location, or the local timezone if nil.
func ToUint32Slice ¶
func ToUint32Slice(i interface{}) []uint32
ToUint32Slice casts an interface to a []uint32 type.
func ToUint32SliceE ¶
ToUint32SliceE casts an interface to a []int32 type.
func ToUint64Slice ¶
func ToUint64Slice(i interface{}) []uint64
ToUint64Slice casts an interface to a []uint64 type.
func ToUint64SliceE ¶
ToUint64SliceE casts an interface to a []uint64 type.
func ToUintSlice ¶
func ToUintSlice(i interface{}) []uint
ToUintSlice casts an interface to a []uint type.
func ToUintSliceE ¶
ToUintSliceE casts an interface to a []uint type.
func ToUnsigned ¶
func ToUnsigned[N constraints.Unsigned](i any) N
ToUnsigned converts an interface to a unsigned integer type.
func ToUnsignedE ¶
func ToUnsignedE[N constraints.Unsigned](i any) (N, error)
ToUnsignedE converts an interface to a unsigned integer type.
Types ¶
This section is empty.