serial

package
v4.1.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Concat

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

func GetInstance

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

func GetMessageType

func GetMessageType(message proto.Message) string

func ReadUint16

func ReadUint16(reader io.Reader) (uint16, error)

func ToString

func ToString(v interface{}) string

ToString serialize an abitrary value into string.

func WriteString

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

func WriteUint16

func WriteUint16(writer io.Writer, value uint16) (int, error)

func WriteUint32

func WriteUint32(writer io.Writer, value uint32) (int, error)

func WriteUint64

func WriteUint64(writer io.Writer, value uint64) (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,proto3" json:"type,omitempty"`
	// Serialized proto message.
	Value                []byte   `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

TypedMessage is a 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

func (*TypedMessage) XXX_DiscardUnknown

func (m *TypedMessage) XXX_DiscardUnknown()

func (*TypedMessage) XXX_Marshal

func (m *TypedMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*TypedMessage) XXX_Merge

func (m *TypedMessage) XXX_Merge(src proto.Message)

func (*TypedMessage) XXX_Size

func (m *TypedMessage) XXX_Size() int

func (*TypedMessage) XXX_Unmarshal

func (m *TypedMessage) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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