gen

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: CC0-1.0 Imports: 5 Imported by: 0

Documentation

Overview

Package gen tests all field mapping options.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ColferSizeMax is the upper limit for serial byte sizes.
	ColferSizeMax = 16 * 1024 * 1024
	// ColferListMax is the upper limit for the number of elements in a list.
	ColferListMax = 64 * 1024
)

Colfer configuration attributes

Functions

This section is empty.

Types

type ColferError

type ColferError int

ColferError signals a data mismatch as as a byte index.

func (ColferError) Error

func (i ColferError) Error() string

Error honors the error interface.

type ColferMax

type ColferMax string

ColferMax signals an upper limit breach.

func (ColferMax) Error

func (m ColferMax) Error() string

Error honors the error interface.

type ColferTail

type ColferTail int

ColferTail signals data continuation as a byte index.

func (ColferTail) Error

func (i ColferTail) Error() string

Error honors the error interface.

type O

type O struct {
	// B tests booleans.
	B bool
	// U32 tests unsigned 32-bit integers.
	U32 uint32
	// U64 tests unsigned 64-bit integers.
	U64 uint64
	// I32 tests signed 32-bit integers.
	I32 int32
	// I64 tests signed 64-bit integers.
	I64 int64
	// F32 tests 32-bit floating points.
	F32 float32
	// F64 tests 64-bit floating points.
	F64 float64
	// T tests timestamps.
	T time.Time
	// S tests text.
	S string
	// A tests binaries.
	A []byte
	// O tests nested data structures.
	O *O
	// Os tests data structure lists.
	Os []*O
	// Ss tests text lists.
	Ss []string
	// As tests binary lists.
	As [][]byte
	// U8 tests unsigned 8-bit integers.
	U8 uint8
	// U16 tests unsigned 16-bit integers.
	U16 uint16
	// F32s tests 32-bit floating point lists.
	F32s []float32
	// F64s tests 64-bit floating point lists.
	F64s []float64
}

O contains all supported data types.

func (*O) MarshalBinary

func (o *O) MarshalBinary() (data []byte, err error)

MarshalBinary encodes o as Colfer conform encoding.BinaryMarshaler. All nil entries in o.Os will be replaced with a new value. The error return option is gen.ColferMax.

func (*O) MarshalLen

func (o *O) MarshalLen() (int, error)

MarshalLen returns the Colfer serial byte size. The error return option is gen.ColferMax.

func (*O) MarshalTo

func (o *O) MarshalTo(buf []byte) int

MarshalTo encodes o as Colfer into buf and returns the number of bytes written. If the buffer is too small, MarshalTo will panic. All nil entries in o.Os will be replaced with a new value.

func (*O) Unmarshal

func (o *O) Unmarshal(data []byte) (int, error)

Unmarshal decodes data as Colfer and returns the number of bytes read. The error return options are io.EOF, gen.ColferError and gen.ColferMax.

func (*O) UnmarshalBinary

func (o *O) UnmarshalBinary(data []byte) error

UnmarshalBinary decodes data as Colfer conform encoding.BinaryUnmarshaler. The error return options are io.EOF, gen.ColferError, gen.ColferTail and gen.ColferMax.

Jump to

Keyboard shortcuts

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