sgob

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package sgob wraps the gob package to stream encoding of lists and maps of objects.

By default, the gob package encodes a large slice of map into a buffer and then makes a single Write call to the underlying buffer. This has the disadvantage that large objects have to be encoded entirely in memory before being written to the stream.

This package works around this restriction by allowing top-level slices and maps to be encoded piece by piece, meaning that each object is first encoded in memory and then written to the stream. A disadvantage is that the corresponding decode also has to be performed using this package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(decoder *gob.Decoder, obj any) error

Decode decodes object from this decoder.

func DecodeValue

func DecodeValue(decoder *gob.Decoder, value reflect.Value) error

DecodeValue is like Decode, but takes a reflect.Value.

func Encode

func Encode(encoder *gob.Encoder, obj any) error

Encode encodes object into the given encoder.

func EncodeValue

func EncodeValue(encoder *gob.Encoder, value reflect.Value) error

EncodeValue is like Encode, but takes a reflect.Value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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