codec

package
v0.0.0-...-1f6331a Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2023 License: MulanPSL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DeregisterCompressor

func DeregisterCompressor(name CompressorType)

func DeregisterSerializer

func DeregisterSerializer(name SerializerType)

func RegisterCompressor

func RegisterCompressor(name CompressorType, compressor Compressor)

func RegisterSerializer

func RegisterSerializer(name SerializerType, serializer Serializer)

Types

type Compressor

type Compressor interface {
	Compress([]byte) ([]byte, error)
	Decompress([]byte) ([]byte, error)
}

func GetCompressor

func GetCompressor(name CompressorType) Compressor

type CompressorType

type CompressorType string
const GzipCompressorType CompressorType = "gzip"
const LzwCompressorType CompressorType = "lzw"
const NoopCompressorType CompressorType = "noop"

type Serializer

type Serializer interface {
	Serialize(interface{}) ([]byte, error)
	Deserialize([]byte, interface{}) error
}

func GetSerializer

func GetSerializer(name SerializerType) Serializer

type SerializerType

type SerializerType string
const JSONSerializerType SerializerType = "json"
const JsoniterSerializerType SerializerType = "jsoniter"
const JsonpbSerializerType SerializerType = "jsonpb"
const NoopSerializerType SerializerType = "noop"
const ProtobufSerializerType SerializerType = "protobuf"
const XMLSerializerType SerializerType = "xml"

Jump to

Keyboard shortcuts

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