gotiny

package
v2.2.5 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2020 License: MIT, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetName

func GetName(obj interface{}) string

func GetNameByType

func GetNameByType(rt reflect.Type) string

func Marshal

func Marshal(is ...interface{}) []byte

func Register

func Register(i interface{}) string

func RegisterName

func RegisterName(name string, rt reflect.Type)

func Unmarshal

func Unmarshal(buf []byte, is ...interface{}) int

func UnusedUnixNanoEncodeTimeType

func UnusedUnixNanoEncodeTimeType()

Types

type Decoder

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

func NewDecoder

func NewDecoder(is ...interface{}) *Decoder

func NewDecoderWithPtr

func NewDecoderWithPtr(is ...interface{}) *Decoder

func NewDecoderWithType

func NewDecoderWithType(ts ...reflect.Type) *Decoder

func (*Decoder) Decode

func (d *Decoder) Decode(buf []byte, is ...interface{}) int

is is pointer of variable

func (*Decoder) DecodePtr

func (d *Decoder) DecodePtr(buf []byte, ps ...unsafe.Pointer) int

ps is a unsafe.Pointer of the variable

func (*Decoder) DecodeValue

func (d *Decoder) DecodeValue(buf []byte, vs ...reflect.Value) int

type Encoder

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

func NewEncoder

func NewEncoder(is ...interface{}) *Encoder

创建一个编码is 类型的编码器

func NewEncoderWithPtr

func NewEncoderWithPtr(ps ...interface{}) *Encoder

创建一个编码ps 指向类型的编码器

func NewEncoderWithType

func NewEncoderWithType(ts ...reflect.Type) *Encoder

func (*Encoder) AppendTo

func (e *Encoder) AppendTo(buf []byte)

编码产生的数据将append到buf上

func (*Encoder) Encode

func (e *Encoder) Encode(is ...interface{}) []byte

入参是要编码值的指针

func (*Encoder) EncodePtr

func (e *Encoder) EncodePtr(ps ...unsafe.Pointer) []byte

入参是要编码的值得unsafe.Pointer 指针

func (*Encoder) EncodeValue

func (e *Encoder) EncodeValue(vs ...reflect.Value) []byte

vs 是持有要编码的值

type GoTinySerializer

type GoTinySerializer interface {
	// 编码方法,将对象的序列化结果append到入参数并返回,方法不应该修改入参数值原有的值
	GotinyEncode([]byte) []byte
	// 解码方法,将入参解码到对象里并返回使用的长度。方法从入参的第0个字节开始使用,并且不应该修改入参中的任何数据
	GotinyDecode([]byte) int
}

只应该由指针来实现该接口

Jump to

Keyboard shortcuts

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