Documentation
¶
Index ¶
- func LengthPrefixedChunking(reader io.Reader, magicNumber byte, maxChunkSize uint32, ...) error
- func LineBasedChunking(reader io.Reader, maxChunkSize int, processor func([]byte) error) error
- func Map[From any, To any](f func(From) To, arr []From) []To
- func MapToStruct[T any](m map[string]any) (*T, error)
- func MarshalCBOR[T any](v T) ([]byte, error)
- func MarshalGob(v any) ([]byte, error)
- func MarshalJson[T any](data T) string
- func MarshalJsonBytes[T any](data T) []byte
- func MarshalPluginID(author string, name string, version string) string
- func MarshalYaml[T any](data T) string
- func MarshalYamlBytes[T any](data T) []byte
- func ParserCommaSeparatedValues[T any](data []byte) (T, error)
- func SnakeToCamel(s string) string
- func StructToMap(data any) map[string]any
- func ToPtr[T any](value T) *T
- func UnmarshalCBOR[T any](data []byte) (T, error)
- func UnmarshalGob[T any](data []byte) (T, error)
- func UnmarshalJson[T any](text string) (T, error)
- func UnmarshalJson2Map(json string) (map[string]any, error)
- func UnmarshalJsonBytes[T any](data []byte) (T, error)
- func UnmarshalJsonBytes2Map(data []byte) (map[string]any, error)
- func UnmarshalJsonBytes2Slice[T any](data []byte) ([]T, error)
- func UnmarshalYaml[T any](text string, validator ...validator.Validate) (T, error)
- func UnmarshalYaml2Map(yaml []byte) (map[string]any, error)
- func UnmarshalYamlBytes[T any](data []byte, validator ...validator.Validate) (T, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LengthPrefixedChunking ¶
func LengthPrefixedChunking( reader io.Reader, magicNumber byte, maxChunkSize uint32, processor func([]byte) error, ) error
We uses following format: All data is stored in little endian format
| Field | Size | Description | |---------------|----------|---------------------------------| | Magic Number | 1 byte | Magic number identifier | | Reserved | 1 byte | Reserved field | | Header Length | 2 bytes | Header length (usually 0xa) | | Data Length | 4 bytes | Length of the data | | Reserved | 6 bytes | Reserved fields | | Data | Variable | Actual data content | | Reserved Fields | Header | Data | |-----------------|----------|----------| | 4 bytes total | Variable | Variable |
NOTE: this function is not thread safe
func LineBasedChunking ¶
func MarshalCBOR ¶
func MarshalGob ¶
func MarshalJson ¶
func MarshalJsonBytes ¶
func MarshalYaml ¶
func MarshalYamlBytes ¶
func ParserCommaSeparatedValues ¶
ParserCommaSeparatedValues parses the comma separated values and returns a map of key-value pairs examples: data: a=1,b=2
T: type struct { A int `comma:"a"` B string `comma:"b"` } return: T{A: 1, B: "2"}
func SnakeToCamel ¶
func StructToMap ¶
func UnmarshalCBOR ¶
func UnmarshalGob ¶
func UnmarshalJson ¶
func UnmarshalJsonBytes ¶
func UnmarshalYaml ¶
func UnmarshalYamlBytes ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.