dsd

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: GPL-3.0 Imports: 7 Imported by: 12

Documentation

Index

Constants

View Source
const (
	AUTO = 0
	NONE = 1

	// special
	LIST = 76 // L

	// serialization
	STRING  = 83 // S
	BYTES   = 88 // X
	JSON    = 74 // J
	BSON    = 66 // B
	GenCode = 71 // G

	// compression
	GZIP = 90 // Z
)

define types

Variables

This section is empty.

Functions

func DecompressAndLoad added in v0.4.1

func DecompressAndLoad(data []byte, format uint8, t interface{}) (interface{}, error)

DecompressAndLoad decompresses the data using the specified compression format and then loads the resulting data blob into the interface.

func Dump

func Dump(t interface{}, format uint8) ([]byte, error)

Dump stores the interface as a dsd formatted data structure.

func DumpAndCompress added in v0.4.1

func DumpAndCompress(t interface{}, format uint8, compression uint8) ([]byte, error)

DumpAndCompress stores the interface as a dsd formatted data structure and compresses the resulting data.

func DumpIndent added in v0.4.1

func DumpIndent(t interface{}, format uint8, indent string) ([]byte, error)

DumpIndent stores the interface as a dsd formatted data structure with indentation, if available.

func Load

func Load(data []byte, t interface{}) (interface{}, error)

Load loads an dsd structured data blob into the given interface.

func LoadAsFormat

func LoadAsFormat(data []byte, format uint8, t interface{}) (interface{}, error)

LoadAsFormat loads a data blob into the interface using the specified format.

Types

type GenCodeCompatible added in v0.3.0

type GenCodeCompatible interface {
	// GenCodeMarshal gencode marshalls the struct into the given byte array, or a new one if its too small.
	GenCodeMarshal(buf []byte) ([]byte, error)
	// GenCodeUnmarshal gencode unmarshalls the struct and returns the bytes read.
	GenCodeUnmarshal(buf []byte) (uint64, error)
}

GenCodeCompatible is an interface to identify and use gencode compatible structs.

Jump to

Keyboard shortcuts

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