Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewUnsupportedCompressionTypeError ¶
NewUnsupportedCompressionTypeError create a new unsupported compression type error
Types ¶
type CompressedBytes ¶
type CompressedBytes struct { Type Type `json:"type,omitempty"` Data []byte `json:"data,omitempty"` }
CompressedBytes represents compressed data and which compression method is used. It stores compressed data in binary form.
func (*CompressedBytes) DecodeTo ¶
func (c *CompressedBytes) DecodeTo(obj interface{}) error
DecodeTo decodes the compressed data and unmarshal it into the given object. obj must be a pointer.
func (*CompressedBytes) EncodeFrom ¶
func (c *CompressedBytes) EncodeFrom(obj interface{}) (err error)
EncodeFrom encodes the given data using the given compression type. Note that it first JSON-marshals the object, then compresses it.
func (*CompressedBytes) SetType ¶
func (c *CompressedBytes) SetType(t Type)
SetType sets the compression type.
type CompressedText ¶
type CompressedText struct { Type Type `json:"type,omitempty"` Data string `json:"data,omitempty"` }
CompressedText represents compressed data and which compression method is used. It stores compressed data in text form (base64), which can be used in JSON, yaml, etc.
func (*CompressedText) DecodeTo ¶
func (c *CompressedText) DecodeTo(obj interface{}) error
DecodeTo decodes the compressed data and unmarshal it into the given object. obj must be a pointer.
func (*CompressedText) EncodeFrom ¶
func (c *CompressedText) EncodeFrom(obj interface{}) error
EncodeFrom encodes the given data using the given compression type. Note that it first JSON-marshals the object, compresses it, and encodes it in base64.
func (*CompressedText) SetType ¶
func (c *CompressedText) SetType(t Type)
SetType sets the compression type.
type Type ¶
type Type string
Type the compression type
const ( // Uncompressed does not compress data. Note that you should NOT actually Uncompressed // Type. We do not provide a compressor for Uncompressed Type. // It is just for compatibility purposes. Uncompressed Type = "" // Gzip compresses data using gzip Gzip Type = "gzip" // Zstd compresses data using zstd Zstd Type = "zstd" )