codec

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasRegister

func HasRegister(name PACK) bool

func Register

func Register(name PACK, adapter Instance)

Types

type Codec

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

func NewMCPack

func NewMCPack() Codec

func PluginInstance

func PluginInstance(name PACK) (adapter Codec)

type Instance

type Instance func() Codec

type MCPack

type MCPack struct{}

func (*MCPack) Marshal

func (mc *MCPack) Marshal(v interface{}) ([]byte, error)

func (*MCPack) Unmarshal

func (mc *MCPack) Unmarshal(data []byte, v interface{}) error

type PACK

type PACK string
const (
	MCPACK PACK = "mcpack" //mcpack 算法: like Json decode/encode
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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