conversion

package
v0.0.0-...-1e877d2 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToString

func ByteToString(b []byte) string

ByteToString 自定义byte转string 解决强转效率低:先分配一个内存再复制内容

ByteToString([]byte("why"))

func DeepCopy

func DeepCopy(dst, src interface{}) error

DeepCopy 深拷贝转换

 type User struct {
	 A string
 }
 user1 := &User{A:"a"}
 user2 := new(User)
 conversion.DeepCopy(user2, user1)

func InterfaceFloat64ToInt16

func InterfaceFloat64ToInt16(str interface{}) int16

InterfaceFloat64ToInt16 interface转int16

func InterfaceFloat64ToInt32

func InterfaceFloat64ToInt32(str interface{}) int32

InterfaceFloat64ToInt32 interface转int32

func InterfaceFloat64ToInt64

func InterfaceFloat64ToInt64(str interface{}) int64

InterfaceFloat64ToInt64 interface转in64

func InterfaceFloat64ToInt8

func InterfaceFloat64ToInt8(str interface{}) int8

InterfaceFloat64ToInt8 interface转int8

func InterfaceFloat64ToUint16

func InterfaceFloat64ToUint16(str interface{}) uint16

InterfaceFloat64ToUint16 interface转uint16

func InterfaceFloat64ToUint32

func InterfaceFloat64ToUint32(str interface{}) uint32

InterfaceFloat64ToUint32 interface转uint32

func InterfaceFloat64ToUint64

func InterfaceFloat64ToUint64(str interface{}) uint64

InterfaceFloat64ToUint64 interface转uint64

func InterfaceFloat64ToUint8

func InterfaceFloat64ToUint8(str interface{}) uint8

InterfaceFloat64ToUint8 interface转uint8

func InterfaceStringToInt16

func InterfaceStringToInt16(str interface{}) int16

InterfaceStringToInt16 interface转int16

func InterfaceStringToInt32

func InterfaceStringToInt32(str interface{}) int32

InterfaceStringToInt32 interface转in32

func InterfaceStringToInt64

func InterfaceStringToInt64(str interface{}) int64

InterfaceStringToInt64 interface转int64

func InterfaceStringToInt8

func InterfaceStringToInt8(str interface{}) int8

InterfaceStringToInt8 interface转int8

func InterfaceStringToUint16

func InterfaceStringToUint16(str interface{}) uint16

InterfaceStringToUint16 interface转uint16

func InterfaceStringToUint64

func InterfaceStringToUint64(str interface{}) uint64

InterfaceStringToUint64 interface转uint64

func InterfaceStringToUint8

func InterfaceStringToUint8(str interface{}) uint8

InterfaceStringToUint8 interface转uint8

func JsonEncode

func JsonEncode(v interface{}) (string, error)

JsonEncode interface格式化为json

func JsonToMap

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

JsonToMap json转map

func JsonToMapArray

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

JsonToMapArray json转map数组

func ReaderToStruct

func ReaderToStruct(reader io.Reader, val interface{}) error

ReaderToStruct 解析reader到结构体

func StringToByte

func StringToByte(str string) []byte

StringToByte 自定义string转byte 解决强转内存分配效率低问题

StringToByte("str")

func StringToInt16

func StringToInt16(str string) int16

StringToInt16 string转int16

func StringToInt32

func StringToInt32(str string) int32

StringToInt32 string转int32

func StringToInt64

func StringToInt64(str string) int64

StringToInt64 string转int64

func StringToInt8

func StringToInt8(str string) int8

StringToInt8 string转int8

func StringToUint16

func StringToUint16(str string) uint16

StringToUint16 string转uint16

func StringToUint64

func StringToUint64(str string) uint64

StringToUint64 string转uint64

func StringToUint8

func StringToUint8(str string) uint8

StringToUint8 string转uint

func StructToJson

func StructToJson(v interface{}) (string, error)

StructToJson 结构体转json

func StructToJsonByReflect

func StructToJsonByReflect(v interface{}) (string, error)

StructToJsonByReflect 通过反射结构体转json

func StructToMap

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

StructToMap struct转map

Types

This section is empty.

Jump to

Keyboard shortcuts

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