Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthEncoding        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowEncoding          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupEncoding = fmt.Errorf("proto: unexpected end of group")
)

Functions

func Decode

func Decode(bs []byte, msg proto.Message) error

    Single shot decoding

    func Encode

    func Encode(msg proto.Message) ([]byte, error)

      Single shot encoding

      func ReadMessage

      func ReadMessage(r io.Reader, pb proto.Message) (int, error)

        Read messages with length-prefix framing from the provided Reader. Returns the number of bytes read and io.EOF if ReadMessage is called exactly on the end of a stream.

        func WriteMessage

        func WriteMessage(w io.Writer, pb proto.Message) (int, error)

          Write messages with length-prefix framing to the provider Writer. Returns the number of bytes written.

          Types

          type Buffer

          type Buffer struct {
          	*proto.Buffer
          }

          func NewBuffer

          func NewBuffer(bs []byte) *Buffer

            Centralise proto.Buffer constructor. gogo protobuf freaks out about deterministic marshalling on objects with custom marshallers so we use google protobuf here

            type TestMessage

            type TestMessage struct {
            	Type                 uint32   `protobuf:"varint,1,opt,name=Type,proto3" json:"Type,omitempty"`
            	Amount               uint64   `protobuf:"varint,2,opt,name=Amount,proto3" json:"Amount,omitempty"`
            	XXX_NoUnkeyedLiteral struct{} `json:"-"`
            	XXX_unrecognized     []byte   `json:"-"`
            	XXX_sizecache        int32    `json:"-"`
            }

              For testing

              func (*TestMessage) Descriptor

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

              func (*TestMessage) GetAmount

              func (m *TestMessage) GetAmount() uint64

              func (*TestMessage) GetType

              func (m *TestMessage) GetType() uint32

              func (*TestMessage) Marshal

              func (m *TestMessage) Marshal() (dAtA []byte, err error)

              func (*TestMessage) MarshalTo

              func (m *TestMessage) MarshalTo(dAtA []byte) (int, error)

              func (*TestMessage) MarshalToSizedBuffer

              func (m *TestMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)

              func (*TestMessage) ProtoMessage

              func (*TestMessage) ProtoMessage()

              func (*TestMessage) Reset

              func (m *TestMessage) Reset()

              func (*TestMessage) Size

              func (m *TestMessage) Size() (n int)

              func (TestMessage) String

              func (tm TestMessage) String() string

              func (*TestMessage) Unmarshal

              func (m *TestMessage) Unmarshal(dAtA []byte) error

              func (*TestMessage) XXX_DiscardUnknown

              func (m *TestMessage) XXX_DiscardUnknown()

              func (*TestMessage) XXX_Marshal

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

              func (*TestMessage) XXX_Merge

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

              func (*TestMessage) XXX_MessageName

              func (*TestMessage) XXX_MessageName() string

              func (*TestMessage) XXX_Size

              func (m *TestMessage) XXX_Size() int

              func (*TestMessage) XXX_Unmarshal

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

              Directories

              Path Synopsis