decoder

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

README

编码器

介绍

  • 2022/11/28
  • 编码器模块

帮助

  • 我们要做什么?
  • 只专注于2件事即可,编码与解码

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JsonDecoderBytes

func JsonDecoderBytes(bytes []byte) messages.Message

JsonDecoderBytes 工具方法

func ProtoDecoderBytes

func ProtoDecoderBytes(bytes []byte) messages.Message

ProtoDecoderBytes 工具方法

Types

type Decoder

type Decoder interface {
	// DecoderBytes 收到客户端的数据
	DecoderBytes(bytes []byte) messages.Message
	// EncodeBytes 封装编码
	EncodeBytes(result interface{}) []byte
}

Decoder 对数据的解码器

type JsonDecoder

type JsonDecoder struct {
}

func (JsonDecoder) DecoderBytes

func (d JsonDecoder) DecoderBytes(bytes []byte) messages.Message

DecoderBytes 处理客户端返回的数据

func (JsonDecoder) EncodeBytes

func (d JsonDecoder) EncodeBytes(result interface{}) []byte

EncodeBytes 编码为字节

func (JsonDecoder) Tool added in v0.0.24

func (d JsonDecoder) Tool(cmd, subCmd int64, body interface{}) []byte

Tool 工具方法

type ProtoDecoder

type ProtoDecoder struct {
}

func (ProtoDecoder) DecoderBytes

func (p ProtoDecoder) DecoderBytes(bytes []byte) messages.Message

func (ProtoDecoder) EncodeBytes

func (p ProtoDecoder) EncodeBytes(result interface{}) []byte

func (ProtoDecoder) Tool added in v0.0.24

func (p ProtoDecoder) Tool(cmd, subCmd int64, body proto.Message) []byte

Tool 工具方法,用于简化编码,减少代码量

Jump to

Keyboard shortcuts

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