codec

package
v0.0.0-...-78e603a Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ByteCodec

type ByteCodec struct{}

func (*ByteCodec) Marshal

func (b *ByteCodec) Marshal(v any) ([]byte, error)

func (*ByteCodec) Unmarshal

func (b *ByteCodec) Unmarshal(data []byte, v any) error

type CompressorCodec

type CompressorCodec interface {
	Compress([]byte) ([]byte, error)
	DeCompress([]byte) ([]byte, error)
}

type CryptoCodec

type CryptoCodec interface {
	Encrypt([]byte) ([]byte, error)
	Decrypt([]byte) ([]byte, error)
}

func NewAesCryptoCodec

func NewAesCryptoCodec(key []byte) CryptoCodec

func NewRsaCryptoCodec

func NewRsaCryptoCodec(privateKey []byte, publicKey []byte) CryptoCodec

type GzipCompressor

type GzipCompressor struct{}

func (*GzipCompressor) Compress

func (g *GzipCompressor) Compress(data []byte) (compressedData []byte, err error)

func (*GzipCompressor) DeCompress

func (g *GzipCompressor) DeCompress(data []byte) ([]byte, error)

type JSONCodec

type JSONCodec struct{}

func (*JSONCodec) Marshal

func (j *JSONCodec) Marshal(v any) ([]byte, error)

func (*JSONCodec) Unmarshal

func (j *JSONCodec) Unmarshal(data []byte, v any) error

type PayloadCodec

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

PayloadCodec is used to marshal and unmarshal payload.

type ProtoBufCodec

type ProtoBufCodec struct{}

func (*ProtoBufCodec) Marshal

func (c *ProtoBufCodec) Marshal(v any) ([]byte, error)

func (*ProtoBufCodec) Unmarshal

func (c *ProtoBufCodec) Unmarshal(data []byte, v any) error

type SnappyCompressor

type SnappyCompressor struct{}

SnappyCompressor implements snappy compressor

func (*SnappyCompressor) Compress

func (s *SnappyCompressor) Compress(data []byte) ([]byte, error)

func (*SnappyCompressor) DeCompress

func (s *SnappyCompressor) DeCompress(data []byte) ([]byte, error)

Directories

Path Synopsis
aws

Jump to

Keyboard shortcuts

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