utils

package
v0.0.0-...-e8f2edf Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressGZIP

func CompressGZIP(data []byte) (compressedData []byte, err error)

func CompressWhenNeeded

func CompressWhenNeeded(data []byte) (resultData []byte, compression *string, err error)

TODO: check if it's worth trying to compress the data prior to compressing it (e.g: using entropy algorithms) This would save some CPU usage client side TODO: have telemetry data type be passed in as a parameter to further check if we should compress data and which algorithm to use (e.g: deflate or gzip)

func DecompressGZIP

func DecompressGZIP(compressedData []byte) (decompressedData []byte, err error)

func DecompressWhenNeeded

func DecompressWhenNeeded(data []byte, compression sql.NullString) (resultData []byte, err error)

TODO: have telemetry data type be passed in as a parameter to further check if we should decompress data and which algorithm to use (e.g: deflate or gzip)

func DeserializeMap

func DeserializeMap(jsonStr string) (map[string]interface{}, error)

func GenerateRandomString

func GenerateRandomString(length int) string

func HumanReadableSize

func HumanReadableSize(data []byte) string

func SerializeMap

func SerializeMap(m map[string]interface{}) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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