compression

package
v1.6.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GunzipStringToObject

func GunzipStringToObject(compressed string, obj interface{}) error

GunzipStringToObject decode the compressed string with base64, decompress it with gzip, unmarshal it into obj

func GzipObjectToString

func GzipObjectToString(obj interface{}) (string, error)

GzipObjectToString marshal object into json, compress it with gzip, encode the result with base64

func NewUnsupportedCompressionTypeError

func NewUnsupportedCompressionTypeError(t string) error

NewUnsupportedCompressionTypeError create a new unsupported compression type error

func UnZstdStringToObject

func UnZstdStringToObject(encoded string, obj interface{}) error

UnZstdStringToObject decodes the compressed string with base64, decompresses it with zstd, and unmarshals it. obj must be a pointer so that it can be updated.

func ZstdObjectToString

func ZstdObjectToString(obj interface{}) (string, error)

ZstdObjectToString marshals the object into json, compress it with zstd, encode the result with base64.

Types

type Type

type Type string

Type the compression type

const (
	// Uncompressed does not compress or encode data
	Uncompressed Type = ""
	// Gzip compresses data using gzip and encodes it using base64
	Gzip Type = "gzip"
	// Zstd compresses data using zstd and encodes it using base64
	Zstd Type = "zstd"
)

Jump to

Keyboard shortcuts

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