conv

package
v0.3.9 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IntPtrTo64

func IntPtrTo64(ptr interface{}) (value int64)

func MapToStruct

func MapToStruct(data map[string]interface{}, obj interface{}) error

MapToStruct map转Struct

func String

func String(bytes *[]byte) *string

[]byte to string

func StructToMap

func StructToMap(a any) map[string]any

StructToMap converts struct to map[string]any. Such as struct{I int, S string}{I: 1, S: "a"} to map["I":1 "S":"a"]. Note that unexported fields of struct can't be converted.

func StructToMapStr added in v0.3.5

func StructToMapStr(a any) map[string]string

StructToMapStr converts struct to map[string]string. Such as struct{I int, S string}{I: 1, S: "a"} to map["I":"1" "S":"a"]. Note that unexported fields of struct can't be converted.

func ToAny added in v0.3.5

func ToAny[T any](a any) T

func ToAnyλ added in v0.3.5

func ToAnyλ[T any](a any) (T, error)

ToAnyλ converts one type to another and returns an error if occurred.

func ToBool added in v0.3.5

func ToBool(a any) bool

ToBool casts any type to a bool type.

func ToBoolλ added in v0.3.5

func ToBoolλ(a any) (bool, error)

ToBoolλ casts any type to a bool type.

func ToDuration added in v0.3.5

func ToDuration(i any) time.Duration

ToDuration casts any type to a time.Duration type.

func ToDurationλ added in v0.3.5

func ToDurationλ(i any) (time.Duration, error)

ToDurationλ casts any type to time.Duration type.

func ToFloat32 added in v0.3.5

func ToFloat32(i any) float32

ToFloat32 casts any type to a float32 type.

func ToFloat32λ added in v0.3.5

func ToFloat32λ(i any) (float32, error)

ToFloat32λ casts any type to a float32 type.

func ToFloat64 added in v0.3.5

func ToFloat64(i any) float64

ToFloat64 casts any type to a float64 type.

func ToFloat64λ added in v0.3.5

func ToFloat64λ(i any) (float64, error)

ToFloat64λ casts any type to a float64 type.

func ToInt added in v0.3.5

func ToInt(i any) int

ToInt casts any type to an int type.

func ToInt16 added in v0.3.5

func ToInt16(i any) int16

ToInt16 casts any type to an int16 type.

func ToInt16λ added in v0.3.5

func ToInt16λ(i any) (int16, error)

ToInt16λ casts any type to an int16 type.

func ToInt32 added in v0.3.5

func ToInt32(i any) int32

ToInt32 casts any type to an int32 type.

func ToInt32λ added in v0.3.5

func ToInt32λ(i any) (int32, error)

ToInt32λ casts any type to an int32 type.

func ToInt64 added in v0.3.5

func ToInt64(i any) int64

ToInt64 casts any type to an int64 type.

func ToInt64λ added in v0.3.5

func ToInt64λ(i any) (int64, error)

ToInt64λ casts any to an int64 type.

func ToInt8 added in v0.3.5

func ToInt8(i any) int8

ToInt8 casts any type to an int8 type.

func ToInt8λ added in v0.3.5

func ToInt8λ(i any) (int8, error)

ToInt8λ casts any type to an int8 type.

func ToIntλ added in v0.3.5

func ToIntλ(i any) (int, error)

ToIntλ casts any type to an int type.

func ToMapStr added in v0.3.5

func ToMapStr(a any) map[string]string

ToMapStr converts any type to a map[string]string type.

func ToMapStrλ added in v0.3.5

func ToMapStrλ(a any) (map[string]string, error)

ToMapStrλ converts any type to a map[string]string type.

func ToString added in v0.3.5

func ToString(i any) string

ToString casts any type to a string type.

func ToStringλ added in v0.3.5

func ToStringλ(i any) (string, error)

ToStringλ casts any type to a string type.

func ToUint added in v0.3.5

func ToUint(i any) uint

ToUint casts any type to a uint type.

func ToUint16 added in v0.3.5

func ToUint16(i any) uint16

ToUint16 casts any type to a uint16 type.

func ToUint16λ added in v0.3.5

func ToUint16λ(i any) (uint16, error)

ToUint16λ casts any type to a uint16 type.

func ToUint32 added in v0.3.5

func ToUint32(i any) uint32

ToUint32 casts any type to a uint32 type.

func ToUint32λ added in v0.3.5

func ToUint32λ(i any) (uint32, error)

ToUint32λ casts any type to a uint32 type.

func ToUint64 added in v0.3.5

func ToUint64(i any) uint64

ToUint64 casts any type to a uint64 type.

func ToUint64λ added in v0.3.5

func ToUint64λ(i any) (uint64, error)

ToUint64λ casts any type to a uint64 type.

func ToUint8 added in v0.3.5

func ToUint8(i any) uint8

ToUint8 casts any type to a uint type.

func ToUint8λ added in v0.3.5

func ToUint8λ(i any) (uint8, error)

ToUint8λ casts any type to a uint type.

func ToUintλ added in v0.3.5

func ToUintλ(i any) (uint, error)

ToUintλ casts any type to a uint type.

func UintPtrTo64

func UintPtrTo64(ptr interface{}) (value uint64)

Types

This section is empty.

Jump to

Keyboard shortcuts

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