packstream

package
v1.8.3 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Dehydrate

type Dehydrate func(x interface{}) (*Struct, error)

Called by packer to let caller send custom object as structs not known by packstream. Used as a convenience to let the caller be lazy and just send in data and be called when packstream doesn't know what it is instead of checking all data up front.

type Hydrate

type Hydrate func(tag StructTag, fields []interface{}) (interface{}, error)

Called by unpacker to let receiver check all fields and let the receiver return an hydrated instance or an error if any of the fields or number of fields are different expected.

type IllegalFormatError

type IllegalFormatError struct {
	// contains filtered or unexported fields
}

func (*IllegalFormatError) Error

func (e *IllegalFormatError) Error() string

type IoError

type IoError struct {
	// contains filtered or unexported fields
}

func (*IoError) Error

func (e *IoError) Error() string

type OverflowError

type OverflowError struct {
	// contains filtered or unexported fields
}

func (*OverflowError) Error

func (e *OverflowError) Error() string

type Packer

type Packer struct {
	// contains filtered or unexported fields
}

func NewPacker

func NewPacker(wr io.Writer, dehydrate Dehydrate) *Packer

func (*Packer) Pack

func (p *Packer) Pack(x interface{}) error

func (*Packer) PackStruct

func (p *Packer) PackStruct(tag StructTag, fields ...interface{}) error

Convenience function for caller that doesn't want to implement Struct interface.

type Struct

type Struct struct {
	Tag    StructTag
	Fields []interface{}
}

type StructTag

type StructTag byte

type Unpacker

type Unpacker struct {
	// contains filtered or unexported fields
}

func NewUnpacker

func NewUnpacker(rd io.Reader) *Unpacker

func (*Unpacker) Unpack

func (u *Unpacker) Unpack(hydrate Hydrate) (interface{}, error)

func (*Unpacker) UnpackStruct

func (u *Unpacker) UnpackStruct(hydrate Hydrate) (interface{}, error)

type UnsupportedTypeError

type UnsupportedTypeError struct {
	// contains filtered or unexported fields
}

func (*UnsupportedTypeError) Error

func (e *UnsupportedTypeError) Error() string

Jump to

Keyboard shortcuts

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