Documentation ¶
Index ¶
- Variables
- func BytesToString(b []byte) string
- func StringToBytes(s string) []byte
- func ToBool[E ~bool](o any) E
- func ToBoolE[E ~bool](o any) (E, error)
- func ToBoolSlice[S ~[]E, E ~bool](o any) S
- func ToBoolSliceE[S ~[]E, E ~bool](o any) (S, error)
- func ToDuration(o any) time.Duration
- func ToDurationE(o any) (time.Duration, error)
- func ToDurationSlice(o any) []time.Duration
- func ToDurationSliceE(o any) ([]time.Duration, error)
- func ToFloat[E constraints.Float](o any) E
- func ToFloat32(o any) float32
- func ToFloat32E(o any) (float32, error)
- func ToFloat32Slice(o any) []float32
- func ToFloat32SliceE(o any) ([]float32, error)
- func ToFloat64(o any) float64
- func ToFloat64E(o any) (float64, error)
- func ToFloat64Slice(o any) []float64
- func ToFloat64SliceE(o any) ([]float64, error)
- func ToFloatE[E constraints.Float](o any) (E, error)
- func ToFloatSlice[S ~[]E, E constraints.Float](o any) S
- func ToFloatSliceE[S ~[]E, E constraints.Float](o any) (S, error)
- func ToInt(o any) int
- func ToInt16(o any) int16
- func ToInt16E(o any) (int16, error)
- func ToInt16Slice(o any) []int16
- func ToInt16SliceE(o any) ([]int16, error)
- func ToInt32(o any) int32
- func ToInt32E(o any) (int32, error)
- func ToInt32Slice(o any) []int32
- func ToInt32SliceE(o any) ([]int32, error)
- func ToInt64(o any) int64
- func ToInt64E(o any) (int64, error)
- func ToInt64Slice(o any) []int64
- func ToInt64SliceE(o any) ([]int64, error)
- func ToInt8(o any) int8
- func ToInt8E(o any) (int8, error)
- func ToInt8Slice(o any) []int8
- func ToInt8SliceE(o any) ([]int8, error)
- func ToIntE(o any) (int, error)
- func ToIntSlice(o any) []int
- func ToIntSliceE(o any) ([]int, error)
- func ToSigned[E constraints.Signed](o any) E
- func ToSignedE[E constraints.Signed](o any) (E, error)
- func ToSignedSlice[S ~[]E, E constraints.Signed](o any) S
- func ToSignedSliceE[S ~[]E, E constraints.Signed](o any) (S, error)
- func ToSlice(o any) []any
- func ToSliceE(o any) ([]any, error)
- func ToString(o any) string
- func ToStringE(o any) (string, error)
- func ToStringMap(o any) map[string]any
- func ToStringMapBool(o any) map[string]bool
- func ToStringMapBoolE(o any) (map[string]bool, error)
- func ToStringMapE(o any) (map[string]any, error)
- func ToStringMapInt(o any) map[string]int
- func ToStringMapInt64(o any) map[string]int64
- func ToStringMapInt64E(o any) (map[string]int64, error)
- func ToStringMapIntE(o any) (map[string]int, error)
- func ToStringMapString(o any) map[string]string
- func ToStringMapStringE(o any) (map[string]string, error)
- func ToStringMapStringSlice(o any) map[string][]string
- func ToStringMapStringSliceE(o any) (map[string][]string, error)
- func ToStringSlice(o any) []string
- func ToStringSliceE(o any) ([]string, error)
- func ToText[E ~string](o any) E
- func ToTextE[E ~string](o any) (E, error)
- func ToTextSlice[S ~[]E, E ~string](o any) S
- func ToTextSliceE[S ~[]E, E ~string](o any) (S, error)
- func ToTime(o any) time.Time
- func ToTimeE(o any) (time.Time, error)
- func ToTimeInLocation(o any, location *time.Location) time.Time
- func ToTimeInLocationE(o any, location *time.Location) (time.Time, error)
- func ToUint(o any) uint
- func ToUint16(o any) uint16
- func ToUint16E(o any) (uint16, error)
- func ToUint16Slice(o any) []uint16
- func ToUint16SliceE(o any) ([]uint16, error)
- func ToUint32(o any) uint32
- func ToUint32E(o any) (uint32, error)
- func ToUint32Slice(o any) []uint32
- func ToUint32SliceE(o any) ([]uint32, error)
- func ToUint64(o any) uint64
- func ToUint64E(o any) (uint64, error)
- func ToUint64Slice(o any) []uint64
- func ToUint64SliceE(o any) ([]uint64, error)
- func ToUint8(o any) uint8
- func ToUint8E(o any) (uint8, error)
- func ToUint8Slice(o any) []uint8
- func ToUint8SliceE(o any) ([]uint8, error)
- func ToUintE(o any) (uint, error)
- func ToUintSlice(o any) []uint
- func ToUintSliceE(a any) ([]uint, error)
- func ToUnsigned[N constraints.Unsigned](o any) N
- func ToUnsignedE[E constraints.Unsigned](o any) (E, error)
- func ToUnsignedSlice[S ~[]E, E constraints.Unsigned](o any) S
- func ToUnsignedSliceE[S ~[]E, E constraints.Unsigned](o any) (S, error)
Constants ¶
This section is empty.
Variables ¶
var ( TimeFormats = []string{ time.Layout, time.ANSIC, time.UnixDate, time.RubyDate, time.RFC822, time.RFC822Z, time.RFC850, time.RFC1123, time.RFC1123Z, time.RFC3339, time.RFC3339Nano, time.Kitchen, time.Stamp, time.StampMilli, time.StampMicro, time.StampNano, time.DateTime, time.DateOnly, time.TimeOnly, "2006-01-02 15:04:05Z07:00", "02 Jan 2006", "2006-01-02 15:04:05 -07:00", "2006-01-02 15:04:05 -0700", "2006-01-02T15:04:05", "2006-01-02 15:04:05.999999999 -0700 MST", "2006-01-02T15:04:05-0700", "2006-01-02 15:04:05Z0700", } )
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 ToBoolSlice ¶
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[E constraints.Float](o any) E
ToFloat converts an interface to a floating-point type.
func ToFloat32E ¶
ToFloat32E casts an interface to a float32 type.
func ToFloat32Slice ¶
ToFloat32Slice casts an interface to a float32 slice type.
func ToFloat32SliceE ¶
ToFloat32SliceE casts an interface to a float32 type.
func ToFloat64E ¶
ToFloat64E casts an interface to a float64 type.
func ToFloat64Slice ¶
ToFloat64Slice casts an interface to a float64 slice type.
func ToFloat64SliceE ¶
ToFloat64SliceE casts an interface to a float64 type.
func ToFloatE ¶
func ToFloatE[E constraints.Float](o any) (E, error)
ToFloatE converts an interface to a floating-point type.
func ToFloatSlice ¶
func ToFloatSlice[S ~[]E, E constraints.Float](o any) S
ToFloatSlice converts an interface to a floating-point slice type.
func ToFloatSliceE ¶
func ToFloatSliceE[S ~[]E, E constraints.Float](o any) (S, error)
ToFloatSliceE converts an interface to a floating-point slice type.
func ToInt16Slice ¶
ToInt16Slice converts an interface to an int16 type.
func ToInt16SliceE ¶
ToInt16SliceE converts an interface to an []int16 type.
func ToInt32Slice ¶
ToInt32Slice casts an interface to a []int32 type.
func ToInt32SliceE ¶
ToInt32SliceE casts an interface to a []int32 type.
func ToInt64Slice ¶
ToInt64Slice casts an interface to a []int64 type.
func ToInt64SliceE ¶
ToInt64SliceE casts an interface to a []int64 type.
func ToInt8Slice ¶
ToInt8Slice converts an interface to an int8 type.
func ToInt8SliceE ¶
ToInt8SliceE converts an interface to an []int8 type.
func ToIntSliceE ¶
ToIntSliceE casts an interface to a []int type.
func ToSigned ¶
func ToSigned[E constraints.Signed](o any) E
ToSigned converts an interface to a signed integer type.
func ToSignedE ¶
func ToSignedE[E constraints.Signed](o any) (E, error)
ToSignedE converts an interface to a signed integer type.
func ToSignedSlice ¶
func ToSignedSlice[S ~[]E, E constraints.Signed](o any) S
ToSignedSlice converts an interface to a signed integer slice type.
func ToSignedSliceE ¶
func ToSignedSliceE[S ~[]E, E constraints.Signed](o any) (S, error)
ToSignedSliceE converts an interface to a signed integer slice type.
func ToStringMap ¶
ToStringMap casts an interface to a map[string]any 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]any 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 ¶
ToStringSlice casts an interface to a []string type.
func ToStringSliceE ¶
ToStringSliceE casts an interface to a []string type.
func ToTextSlice ¶
ToTextSlice casts an interface to a []string type.
func ToTextSliceE ¶
ToTextSliceE casts an interface to a []string type.
func ToTimeInLocation ¶
ToTimeInLocation casts an empty interface to time.Time,
func ToTimeInLocationE ¶
ToTimeInLocationE 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 ToUint16Slice ¶
ToUint16Slice converts an interface to a []uint16 type.
func ToUint16SliceE ¶
ToUint16SliceE converts an interface to a uint16 type.
func ToUint32Slice ¶
ToUint32Slice casts an interface to a []uint32 type.
func ToUint32SliceE ¶
ToUint32SliceE casts an interface to a []int32 type.
func ToUint64Slice ¶
ToUint64Slice casts an interface to a []uint64 type.
func ToUint64SliceE ¶
ToUint64SliceE casts an interface to a []uint64 type.
func ToUint8Slice ¶
ToUint8Slice converts an interface to a []uint8 type.
func ToUint8SliceE ¶
ToUint8SliceE converts an interface to a uint type.
func ToUintSliceE ¶
ToUintSliceE casts an interface to a []uint type.
func ToUnsigned ¶
func ToUnsigned[N constraints.Unsigned](o any) N
ToUnsigned converts an interface to a unsigned integer type.
func ToUnsignedE ¶
func ToUnsignedE[E constraints.Unsigned](o any) (E, error)
ToUnsignedE converts an interface to a unsigned integer type.
func ToUnsignedSlice ¶
func ToUnsignedSlice[S ~[]E, E constraints.Unsigned](o any) S
ToUnsignedSlice converts an interface to an unsigned integer slice type.
func ToUnsignedSliceE ¶
func ToUnsignedSliceE[S ~[]E, E constraints.Unsigned](o any) (S, error)
ToUnsignedSliceE converts an interface to an unsigned integer slice type.
Types ¶
This section is empty.