coding

package
v0.0.0-...-d3f65ed Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2024 License: Apache-2.0 Imports: 3 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrorTypeCode = errors.New("coding: code type error")

Functions

func RegisterCode

func RegisterCode(code Code) error

Types

type Code

type Code interface {
	// Marshal 将v序列化为[]byte
	Marshal(v interface{}) ([]byte, error)

	// Unmarshal 将[]byte 反序列化为v
	Unmarshal(data []byte, v interface{}) error

	// Name 返回实际调用编码器的类型, 例如 json、xml、yaml、proto
	Name() string
}

Code coding 接口

func GetCode

func GetCode(codeName string) Code

type CodeStorage

type CodeStorage struct {
	sync.Mutex
	// contains filtered or unexported fields
}

CodeStorage 注册中心

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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