encodingx

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2023 License: MIT Imports: 8 Imported by: 6

Documentation

Overview

Package encodingx Created by xuzhuoxi on 2019-02-11. @author xuzhuoxi

Package encodingx Created by xuzhuoxi on 2019-03-20. @author xuzhuoxi

Package encodingx Created by xuzhuoxi on 2019-02-11. @author xuzhuoxi

Package encodingx Created by xuzhuoxi on 2019-03-20. @author xuzhuoxi

Package encodingx Created by xuzhuoxi on 2019-03-25. @author xuzhuoxi

Package encodingx Created by xuzhuoxi on 2019-02-13. @author xuzhuoxi

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultOrder            binary.ByteOrder = bytex.DefaultOrder
	DefaultDataBlockHandler                  = bytex.NewDefaultDataBlockHandler()
)

Functions

func ByteArrayToString

func ByteArrayToString(b []byte) string

func StringToByteArray

func StringToByteArray(s string) []byte

Types

type CodingMap

type CodingMap map[string]interface{}

func NewCodingMap

func NewCodingMap() CodingMap

func (CodingMap) Check

func (v CodingMap) Check(key string) bool

func (CodingMap) DecodeFromBytes

func (v CodingMap) DecodeFromBytes(bs []byte) bool

func (CodingMap) Delete

func (v CodingMap) Delete(key string) (interface{}, bool)

func (CodingMap) EncodeToBytes

func (v CodingMap) EncodeToBytes() []byte

EncodeToBytes 序列化 格式:

Key + Value
Key : string(uint16+[]byte)
Value: Kind [+ Len] + Other
Other: []byte... 或 string(uint16+[]byte)...

func (CodingMap) ForEach

func (v CodingMap) ForEach(handler func(key string, value interface{}))

func (CodingMap) Get

func (v CodingMap) Get(key string) (interface{}, bool)

func (CodingMap) Len

func (v CodingMap) Len() int

func (CodingMap) Merge

func (v CodingMap) Merge(vs IKeyValue) IKeyValue

func (CodingMap) Set

func (v CodingMap) Set(key string, value interface{}) (IKeyValue, bool)

type IBuffCodecs

type IBuffCodecs interface {
	bytex.IBuffReset
	bytex.IBuffLen
	// contains filtered or unexported methods
}

func NewBuffCodecs

func NewBuffCodecs(handler bytex.IDataBlockHandler, codingHandler ICodingHandler) IBuffCodecs

func NewDefaultBuffCodecs

func NewDefaultBuffCodecs(codingHandler ICodingHandler) IBuffCodecs

type IBuffDecoder

type IBuffDecoder interface {
	bytex.IBuffReset
	bytex.IBuffLen
	// contains filtered or unexported methods
}

func NewBuffDecoder

func NewBuffDecoder(handler bytex.IDataBlockHandler, decodeHandler IDecodeHandler) IBuffDecoder

func NewDefaultBuffDecoder

func NewDefaultBuffDecoder(decodeHandler IDecodeHandler) IBuffDecoder

type IBuffEncoder

type IBuffEncoder interface {
	bytex.IBuffReset
	bytex.IBuffLen
	// contains filtered or unexported methods
}

func NewBuffEncoder

func NewBuffEncoder(handler bytex.IDataBlockHandler, encodeHandler IEncodeHandler) IBuffEncoder

func NewDefaultBuffEncoder

func NewDefaultBuffEncoder(encodeHandler IEncodeHandler) IBuffEncoder

type ICodingData

type ICodingData interface {
	IEncodingData
	IDecodingData
}

type ICodingHandler

type ICodingHandler interface {
	IEncodeHandler
	IDecodeHandler
}

func NewUtf8StringCodingHandle

func NewUtf8StringCodingHandle() ICodingHandler

type IDecodeHandler

type IDecodeHandler interface {
	HandleDecode(bs []byte, data interface{}) error
}

type IDecodingData

type IDecodingData interface {
	// DecodeFromBytes 反序列化更新
	DecodeFromBytes(bs []byte) bool
}

type IEncodeHandler

type IEncodeHandler interface {
	HandleEncode(data interface{}) []byte
}

type IEncodingData

type IEncodingData interface {
	// EncodeToBytes 序列化
	EncodeToBytes() []byte
}

type IKeyValue

type IKeyValue interface {
	// ICodingData
	// 序列化接口
	ICodingData

	// Len 键值对数量
	Len() int
	// Set 设置键值
	Set(key string, value interface{}) (IKeyValue, bool)
	// Get 取值
	Get(key string) (interface{}, bool)
	// Delete 删除键值
	Delete(key string) (interface{}, bool)
	// Check 检查键值是否存在
	Check(key string) bool

	// Merge 合并
	Merge(vs IKeyValue) IKeyValue
	// ForEach 遍历
	ForEach(handler func(key string, value interface{}))
}

type IPoolBuffCodecs

type IPoolBuffCodecs interface {
	Register(newFunc func() IBuffCodecs)
	GetInstance() IBuffCodecs
	Recycle(instance IBuffCodecs) bool
}

func NewPoolBuffCodecs

func NewPoolBuffCodecs() IPoolBuffCodecs

type IPoolBuffDecoder

type IPoolBuffDecoder interface {
	Register(newFunc func() IBuffDecoder)
	GetInstance() IBuffDecoder
	Recycle(instance IBuffDecoder) bool
}

func NewPoolBuffDecoder

func NewPoolBuffDecoder() IPoolBuffDecoder

type IPoolBuffEncoder

type IPoolBuffEncoder interface {
	Register(newFunc func() IBuffEncoder)
	GetInstance() IBuffEncoder
	Recycle(instance IBuffEncoder) bool
}

func NewPoolBuffEncoder

func NewPoolBuffEncoder() IPoolBuffEncoder

type IPoolCodingHandler

type IPoolCodingHandler interface {
	Register(newFunc func() ICodingHandler)
	GetInstance() ICodingHandler
	Recycle(instance ICodingHandler) bool
}

func NewPoolCodingHandler

func NewPoolCodingHandler() IPoolCodingHandler

Directories

Path Synopsis
Package gobx Created by xuzhuoxi on 2019-03-25.
Package gobx Created by xuzhuoxi on 2019-03-25.
Package jsonx Created by xuzhuoxi on 2019-02-24.
Package jsonx Created by xuzhuoxi on 2019-02-24.
Package yamlx Created by xuzhuoxi on 2019-02-24.
Package yamlx Created by xuzhuoxi on 2019-02-24.

Jump to

Keyboard shortcuts

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