pb

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeInt32

func DecodeInt32(buf []byte, index int) (int, int32)

func DecodeInt64

func DecodeInt64(buf []byte, index int) (int, int64)

func DecodeString

func DecodeString(buf []byte, index int) (int, string)

func WriteIn32

func WriteIn32(buf []byte, v int32, index int)

func WriteInt64

func WriteInt64(buf []byte, v int64, index int)

func WriteSize

func WriteSize(buf []byte, index int, size int)

func WriteString

func WriteString(buf []byte, str string, index int) []byte

Types

type Coder

type Coder struct {
	// contains filtered or unexported fields
}

func GetCoder

func GetCoder(id int) *Coder

可以通过该函数并发获取coder

func Parse

func Parse(def map[int]interface{}, id int) *Coder

func ParseSlice

func ParseSlice(def []interface{}, id int) *Coder

func (*Coder) Decode

func (c *Coder) Decode(buf []byte) (int, interface{})

func (*Coder) Encode

func (c *Coder) Encode(proto interface{}, head int) []byte

打包的数据可以直接发送,无需添加头部

func (*Coder) EncodeBuff

func (c *Coder) EncodeBuff(proto interface{}, head int, buf []byte) (minBuf []byte)

func (*Coder) IsDef

func (c *Coder) IsDef(rType reflect.Type) bool

Jump to

Keyboard shortcuts

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