serial

package
v2.19.5+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2017 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteToHexString

func ByteToHexString(value byte) string

func BytesToHexString

func BytesToHexString(value []byte) string

func BytesToInt64

func BytesToInt64(value []byte) int64

BytesToInt64 deserializes a byte array to an int64 in big endian order. The byte array must have at least 8 elements.

func BytesToUint16

func BytesToUint16(value []byte) uint16

BytesToUint16 deserializes a byte array to an uint16 in big endian order. The byte array must have at least 2 elements.

func BytesToUint32

func BytesToUint32(value []byte) uint32

BytesToUint32 deserializes a byte array to an uint32 in big endian order. The byte array must have at least 4 elements.

func Concat

func Concat(v ...interface{}) string

func GetInstance

func GetInstance(messageType string) (interface{}, error)

func GetMessageType

func GetMessageType(message proto.Message) string

func Int64ToBytes

func Int64ToBytes(value int64, b []byte) []byte

func Int64ToString

func Int64ToString(value int64) string

func IntToBytes

func IntToBytes(value int, b []byte) []byte

func IntToString

func IntToString(value int) string

func ToString

func ToString(v interface{}) string

ToString serialize an abitrary value into string.

func Uint16ToBytes

func Uint16ToBytes(value uint16, b []byte) []byte

Uint16ToBytes serializes an uint16 into bytes in big endian order.

func Uint16ToString

func Uint16ToString(value uint16) string

func Uint32ToBytes

func Uint32ToBytes(value uint32, b []byte) []byte

func Uint32ToString

func Uint32ToString(value uint32) string

func WriteString

func WriteString(s string) func([]byte) (int, error)

func WriteUint16

func WriteUint16(value uint16) func([]byte) (int, error)

func WriteUint32

func WriteUint32(value uint32) func([]byte) (int, error)

Types

type TypedMessage

type TypedMessage struct {
	// The name of the message type, retrieved from protobuf API.
	Type string `protobuf:"bytes,1,opt,name=type" json:"type,omitempty"`
	// Serialized proto message.
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
}

Serialized proto message along with its type name.

func ToTypedMessage

func ToTypedMessage(message proto.Message) *TypedMessage

func (*TypedMessage) Descriptor

func (*TypedMessage) Descriptor() ([]byte, []int)

func (*TypedMessage) GetInstance

func (v *TypedMessage) GetInstance() (proto.Message, error)

func (*TypedMessage) GetType

func (m *TypedMessage) GetType() string

func (*TypedMessage) GetValue

func (m *TypedMessage) GetValue() []byte

func (*TypedMessage) ProtoMessage

func (*TypedMessage) ProtoMessage()

func (*TypedMessage) Reset

func (m *TypedMessage) Reset()

func (*TypedMessage) String

func (m *TypedMessage) String() string

Jump to

Keyboard shortcuts

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