codec

package
v0.4.5 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(c Codec)

Register 注册一个Code, 按照定义的scheme获取Codec 从v0.4.0版本开始LittleRpc在Codec中使用普通map来管理

Types

type Codec

type Codec interface {
	Scheme() string
	Marshal(v interface{}) ([]byte, error)
	Unmarshal(data []byte, v interface{}) error
}

func Get

func Get(scheme string) Codec

Get 根据Scheme获取Codec, 如果Codec不存在, 那么返回的Codec == nil 从v0.4.0版本开始LittleRpc在Codec中使用普通map来管理

type Json

type Json struct{}

func (Json) Marshal

func (j Json) Marshal(v interface{}) ([]byte, error)

func (Json) Scheme

func (j Json) Scheme() string

func (Json) Unmarshal

func (j Json) Unmarshal(data []byte, v interface{}) error

Jump to

Keyboard shortcuts

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