example

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package example. Just data types for testing in here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BlogDecode added in v0.9.0

func BlogDecode(b *Blog, src []byte) (err error)

BlogEncode decodes content of Blog.

func BlogEncode added in v0.9.0

func BlogEncode(dst []byte, b *Blog) []byte

func BlogLen added in v0.9.0

func BlogLen(b *Blog) int

func PerfcheckDecode added in v0.8.4

func PerfcheckDecode(p *Perfcheck, src []byte) (err error)

PerfcheckEncode decodes content of Perfcheck.

func PerfcheckDecodeManual added in v0.9.0

func PerfcheckDecodeManual(p *Perfcheck, src []byte) (err error)

func PerfcheckEncode added in v0.8.4

func PerfcheckEncode(dst []byte, p *Perfcheck) []byte

func PerfcheckLen added in v0.8.4

func PerfcheckLen(p *Perfcheck) int

func StructDecode

func StructDecode(s *Struct, src []byte) (err error)

StructEncode decodes content of Struct.

func StructDecodeManual added in v0.9.0

func StructDecodeManual(s *Struct, src []byte) error

func StructEncode

func StructEncode(dst []byte, s *Struct) []byte

func StructLen added in v0.3.0

func StructLen(s *Struct) int

func TypeRecorderDispatch

func TypeRecorderDispatch(disp Source, rec []byte) error

TypeRecorderDispatch dispatches encoded data made with TypeRecorder

Types

type Blog added in v0.9.0

type Blog struct {
	Header   uint8
	CRC32    uint32
	Time     time.Time
	Level    uint8
	Location Location
	Payload  []byte
}

type EncDec

type EncDec bool

EncDec auto-apply type.

func (*EncDec) Decode

func (x *EncDec) Decode(rec []byte) ([]byte, error)

Decode to auto-apply decoding.

func (EncDec) Encode

func (x EncDec) Encode(buf []byte) []byte

Encode to auto-apply encoding.

func (EncDec) Len

func (x EncDec) Len() int

Len to auto-apply encoding.

type Index

type Index struct {
	Term  uint64
	Index uint64
}

Index to be handled by custom type handler.

type Location added in v0.9.0

type Location struct {
	Valid bool
	File  string
	Line  intypes.VI
}

type Perfcheck added in v0.8.4

type Perfcheck struct {
	F0 int64
	F1 int64
	F2 int64
	F3 int64
	F4 int64
	F5 int64
	F6 int64
	F7 int64
	F8 int64
	F9 int64
}

type Source

type Source interface {
	Fixeds(a bool, b int32, c uint16, d float64, e [12]byte) error
	Vars(a string, b []byte, c intypes.VI16, d intypes.VU32, e EncDec, id Index) error
}

Source interface to generate testing stuff.

type SourceMock

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

SourceMock interface github.com/sirkon/fenneg/example/internal/example.Source mock

func NewSourceMock

func NewSourceMock(ctrl *gomock.Controller) *SourceMock

NewSourceMock creates SourceMock instance

func (*SourceMock) EXPECT

func (m *SourceMock) EXPECT() *SourceMockRecorder

EXPECT returns expected calls recorder

func (*SourceMock) Fixeds

func (m *SourceMock) Fixeds(a bool, b int32, c uint16, d float64, e [12]byte) (err error)

Fixeds method to implement github.com/sirkon/fenneg/example/internal/example.Source

func (*SourceMock) Vars

func (m *SourceMock) Vars(a string, b []byte, c int16, d uint32, e EncDec, id Index) (err error)

Vars method to implement github.com/sirkon/fenneg/example/internal/example.Source

type SourceMockRecorder

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

SourceMockRecorder records expected calls of github.com/sirkon/fenneg/example/internal/example.Source

func (*SourceMockRecorder) Fixeds

func (mr *SourceMockRecorder) Fixeds(a, b, c, d, e any) *gomock.Call

Fixeds register expected call of method github.com/sirkon/fenneg/example/internal/example.Source.Fixeds

func (*SourceMockRecorder) FixedsWhatever

func (mr *SourceMockRecorder) FixedsWhatever() *gomock.Call

FixedsWhatever records a call with arbitrary arguments.

func (*SourceMockRecorder) Vars

func (mr *SourceMockRecorder) Vars(a, b, c, d, e, id any) *gomock.Call

Vars register expected call of method github.com/sirkon/fenneg/example/internal/example.Source.Vars

func (*SourceMockRecorder) VarsWhatever

func (mr *SourceMockRecorder) VarsWhatever() *gomock.Call

VarsWhatever records a call with arbitrary arguments.

type Struct

type Struct struct {
	ID               Index
	ChangeID         Index
	Repeat           uint32
	Theme            uint32
	Data             []byte
	Pi               float32
	E                float64
	Field            string
	Int              int
	Uint             uint
	VarInt           intypes.VI
	VarUint          intypes.VU
	BoolSlice        []bool
	StringSlice      []string
	BoolSliceSlice   [][]bool
	StringSliceSlice [][]string
	MapKFVF          map[uint32]uint32
	MapKFVV          map[uint32]string
	MapKVVF          map[string]uint32
	Struct           StructInternal
	StructSlice      []StructInternal
	StructMapInt     map[int]StructInternal
	StructMapStruct  map[StructInternal]StructInternal
}

type StructInternal added in v0.7.0

type StructInternal struct {
	A int
	B string
}

type TypeRecorder

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

TypeRecorder implement

func (*TypeRecorder) Fixeds

func (t *TypeRecorder) Fixeds(a bool, b int32, c uint16, d float64, e [12]byte) error

Fixeds encodes arguments tuple of this method.

func (*TypeRecorder) Vars

func (t *TypeRecorder) Vars(a string, b []byte, c intypes.VI16, d intypes.VU32, e EncDec, id Index) error

Vars encodes arguments tuple of this method.

Jump to

Keyboard shortcuts

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