serialize

package
v0.0.0-...-4cd9d19 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NULL = "null" //nil   null
)

Variables

View Source
var (
	SerializeObjs map[string]*SerializeData
)

Functions

func BoolToBytes

func BoolToBytes(v interface{}) ([]byte, error)

func ByteToBytes

func ByteToBytes(v interface{}) ([]byte, error)

func BytesToBool

func BytesToBool(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToErrorCode

func BytesToErrorCode(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToFloat32

func BytesToFloat32(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToFloat64

func BytesToFloat64(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToInt

func BytesToInt(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToInt16

func BytesToInt16(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToInt32

func BytesToInt32(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToInt64

func BytesToInt64(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToInt8

func BytesToInt8(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToMapInt32Rpc

func BytesToMapInt32Rpc(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToMapString

func BytesToMapString(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToMapStringRpc

func BytesToMapStringRpc(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToMapUInt32Rpc

func BytesToMapUInt32Rpc(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToNull

func BytesToNull(dataType reflect.Type, buf []byte) (interface{}, error)

反序列化--------------------------------------------------------------------------------------------------------------

func BytesToSliceInt32

func BytesToSliceInt32(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToSliceInterface

func BytesToSliceInterface(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToSliceString

func BytesToSliceString(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToSliceUInt32

func BytesToSliceUInt32(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToString

func BytesToString(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToUInt16

func BytesToUInt16(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToUInt32

func BytesToUInt32(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesToUInt64

func BytesToUInt64(dataType reflect.Type, buf []byte) (interface{}, error)

func BytesTobyte

func BytesTobyte(dataType reflect.Type, buf []byte) (interface{}, error)

func ErrorCodeToBytes

func ErrorCodeToBytes(v interface{}) ([]byte, error)

func Float32ToBytes

func Float32ToBytes(v interface{}) ([]byte, error)

func Float64ToBytes

func Float64ToBytes(v interface{}) ([]byte, error)

func Int16ToBytes

func Int16ToBytes(v interface{}) ([]byte, error)

func Int32ToBytes

func Int32ToBytes(v interface{}) ([]byte, error)

func Int64ToBytes

func Int64ToBytes(v interface{}) ([]byte, error)

func Int8ToBytes

func Int8ToBytes(v interface{}) ([]byte, error)

func IntToBytes

func IntToBytes(v interface{}) ([]byte, error)

func JsonStructMarshal

func JsonStructMarshal(v interface{}) ([]byte, error)

func JsonStructUnmarshal

func JsonStructUnmarshal(dataType reflect.Type, buf []byte) (interface{}, error)

func MapInt32InterfaceToBytes

func MapInt32InterfaceToBytes(v interface{}) ([]byte, error)

func MapStringInterfaceToBytes

func MapStringInterfaceToBytes(v interface{}) ([]byte, error)

func MapUInt32InterfaceToBytes

func MapUInt32InterfaceToBytes(v interface{}) ([]byte, error)

func NullToBytes

func NullToBytes(v interface{}) ([]byte, error)

----------------------------------------------内置序列化-------------------------------------------------------------- 序列化----------------------------------------------------------------------------------------------------------------

func OnRegister

func OnRegister(d interface{}, sf func(d interface{}) ([]byte, error), unsf func(dataType reflect.Type, d []byte) (interface{}, error))

func Serialize

func Serialize(d interface{}) (dtype string, b []byte, err error)

func SerializeInit

func SerializeInit()

func SliceInt32ToBytes

func SliceInt32ToBytes(v interface{}) ([]byte, error)

func SliceInterfaceToBytes

func SliceInterfaceToBytes(v interface{}) ([]byte, error)

func SliceStringToBytes

func SliceStringToBytes(v interface{}) ([]byte, error)

func SliceUInt32ToBytes

func SliceUInt32ToBytes(v interface{}) ([]byte, error)

func StringToBytes

func StringToBytes(v interface{}) ([]byte, error)

func UInt16ToBytes

func UInt16ToBytes(v interface{}) ([]byte, error)

func UInt32ToBytes

func UInt32ToBytes(v interface{}) ([]byte, error)

func UInt64ToBytes

func UInt64ToBytes(v interface{}) ([]byte, error)

func UnSerialize

func UnSerialize(dtype string, d []byte) (interface{}, error)

Types

type RpcData

type RpcData struct {
	Dtype string
	Data  []byte
}

func GetRpcData

func GetRpcData(i interface{}) (*RpcData, string)

type SerializeData

type SerializeData struct {
	SerializeFunc   func(d interface{}) ([]byte, error)
	UnSerializeFunc func(dataType reflect.Type, d []byte) (interface{}, error)
	// contains filtered or unexported fields
}

Jump to

Keyboard shortcuts

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