codec

package
v0.0.0-...-71d5ba4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package test is a generated protocol buffer package.

It is generated from these files:

test.proto

It has these top-level messages:

Person

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTest   = fmt.Errorf("proto: integer overflow")
)

Functions

This section is empty.

Types

type Codec

type Codec interface {
	Marshal(interface{}) (net.MessageBody, error)
	Unmarshal(net.MessageBody, interface{}) error
	Type() int
}

数据传输协议,即包体格式

var (
	JsonCodec     Codec
	ProtobufCodec Codec
)

func NewCodec

func NewCodec(t CodecType) Codec

type CodecType

type CodecType byte
const (
	Json CodecType = iota
	Protobuf
)

type Person

type Person struct {
	Id   int32  `protobuf:"varint,1,req,name=id" json:"id"`
	Name string `protobuf:"bytes,2,opt,name=name" json:"name"`
}

func (*Person) Descriptor

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

func (*Person) GetId

func (m *Person) GetId() int32

func (*Person) GetName

func (m *Person) GetName() string

func (*Person) Marshal

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

func (*Person) MarshalTo

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

func (*Person) ProtoMessage

func (*Person) ProtoMessage()

func (*Person) Reset

func (m *Person) Reset()

func (*Person) Size

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

func (*Person) String

func (m *Person) String() string

func (*Person) Unmarshal

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

Jump to

Keyboard shortcuts

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