gen

package
v0.0.0-...-79b74c8 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2023 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 DromedaryCase

type DromedaryCase struct {
	PascalCase string `xml:"pascal-case" json:"pascal_case,omitempty"`
}

DromedaryCase oposes name casings.

func (*DromedaryCase) MarshalBinary

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

MarshalBinary encodes o as Colfer conform encoding.BinaryMarshaler. The error return option is ColferMax.

func (*DromedaryCase) MarshalLen

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

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

func (*DromedaryCase) MarshalTo

func (o *DromedaryCase) 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.

func (*DromedaryCase) Unmarshal

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

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

func (*DromedaryCase) UnmarshalBinary

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

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

type EmbedO

type EmbedO struct {
	Inner *O
}

EmbedO has an inner object only. Covers regression of issue #66.

func (*EmbedO) MarshalBinary

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

MarshalBinary encodes o as Colfer conform encoding.BinaryMarshaler. The error return option is ColferMax.

func (*EmbedO) MarshalLen

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

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

func (*EmbedO) MarshalTo

func (o *EmbedO) 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.

func (*EmbedO) Unmarshal

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

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

func (*EmbedO) UnmarshalBinary

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

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

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 ColferMax.

func (*O) MarshalLen

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

MarshalLen returns the Colfer serial byte size. The error return option is 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, ColferError and 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, ColferError, ColferTail and ColferMax.

Jump to

Keyboard shortcuts

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