tests

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: Apache-2.0, UNKNOWN, UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefTypes = []interface{}{
	(*IntDef)(nil),
	(*IntAr)(nil),
	(*IntSl)(nil),
	(*ByteAr)(nil),
	(*ByteSl)(nil),
	(*PrimitivesStructSl)(nil),
	(*PrimitivesStructDef)(nil),
}

Creates one much like amino.RegisterPackage, but without registration. This is needed due to circular dependency issues for dependencies of Amino. Another reason to strive for many independent modules. NOTE: Register new repr types here as well. NOTE: This package registration is independent of test registration. See tests/common.go StructTypes etc to add to tests.

Functions

This section is empty.

Types

type AminoMarshalerInt4

type AminoMarshalerInt4 int32

func (AminoMarshalerInt4) MarshalAmino

func (am AminoMarshalerInt4) MarshalAmino() (ReprStruct4, error)

func (*AminoMarshalerInt4) UnmarshalAmino

func (am *AminoMarshalerInt4) UnmarshalAmino(rs ReprStruct4) error

type AminoMarshalerInt5

type AminoMarshalerInt5 int32

func (AminoMarshalerInt5) MarshalAmino

func (am AminoMarshalerInt5) MarshalAmino() (string, error)

func (*AminoMarshalerInt5) UnmarshalAmino

func (am *AminoMarshalerInt5) UnmarshalAmino(repr string) error

type AminoMarshalerStruct1

type AminoMarshalerStruct1 struct {
	A int32
	B int32
}

func (AminoMarshalerStruct1) MarshalAmino

func (ams AminoMarshalerStruct1) MarshalAmino() (ReprStruct1, error)

func (*AminoMarshalerStruct1) UnmarshalAmino

func (ams *AminoMarshalerStruct1) UnmarshalAmino(rs ReprStruct1) error

type AminoMarshalerStruct2

type AminoMarshalerStruct2 struct {
	B int32 // exposed (dontcare)
	// contains filtered or unexported fields
}

func (AminoMarshalerStruct2) MarshalAmino

func (ams AminoMarshalerStruct2) MarshalAmino() ([]ReprElem2, error)

func (*AminoMarshalerStruct2) UnmarshalAmino

func (ams *AminoMarshalerStruct2) UnmarshalAmino(repr []ReprElem2) error

type AminoMarshalerStruct3

type AminoMarshalerStruct3 struct {
	A int32
}

func (AminoMarshalerStruct3) MarshalAmino

func (ams AminoMarshalerStruct3) MarshalAmino() (int32, error)

func (*AminoMarshalerStruct3) UnmarshalAmino

func (ams *AminoMarshalerStruct3) UnmarshalAmino(i int32) error

type AminoMarshalerStruct6

type AminoMarshalerStruct6 struct {
	A int32
	B int32
}

func (AminoMarshalerStruct6) MarshalAmino

func (ams AminoMarshalerStruct6) MarshalAmino() ([]AminoMarshalerStruct1, error)

func (*AminoMarshalerStruct6) UnmarshalAmino

func (ams *AminoMarshalerStruct6) UnmarshalAmino(repr []AminoMarshalerStruct1) error

type AminoMarshalerStruct7

type AminoMarshalerStruct7 struct {
	A int8
}

func (AminoMarshalerStruct7) MarshalAmino

func (ams AminoMarshalerStruct7) MarshalAmino() ([]ReprElem7, error)

func (*AminoMarshalerStruct7) UnmarshalAmino

func (ams *AminoMarshalerStruct7) UnmarshalAmino(repr []ReprElem7) error

type ArraysArraysStruct

type ArraysArraysStruct struct {
	Int8ArAr        [2][2]int8
	Int16ArAr       [2][2]int16
	Int32ArAr       [2][2]int32
	Int32FixedArAr  [2][2]int32 `binary:"fixed32"`
	Int64ArAr       [2][2]int64
	Int64FixedArAr  [2][2]int64 `binary:"fixed64"`
	IntArAr         [2][2]int
	ByteArAr        [2][2]byte
	Uint8ArAr       [2][2]uint8
	Uint16ArAr      [2][2]uint16
	Uint32ArAr      [2][2]uint32
	Uint32FixedArAr [2][2]uint32 `binary:"fixed32"`
	Uint64ArAr      [2][2]uint64
	Uint64FixedArAr [2][2]uint64 `binary:"fixed64"`
	UintArAr        [2][2]uint
	StrArAr         [2][2]string
	BytesArAr       [2][2][]byte
	TimeArAr        [2][2]time.Time
	DurationArAr    [2][2]time.Duration
	EmptyArAr       [2][2]EmptyStruct
}

type ArraysStruct

type ArraysStruct struct {
	Int8Ar        [4]int8
	Int16Ar       [4]int16
	Int32Ar       [4]int32
	Int32FixedAr  [4]int32 `binary:"fixed32"`
	Int64Ar       [4]int64
	Int64FixedAr  [4]int64 `binary:"fixed64"`
	IntAr         [4]int
	ByteAr        [4]byte
	Uint8Ar       [4]uint8
	Uint16Ar      [4]uint16
	Uint32Ar      [4]uint32
	Uint32FixedAr [4]uint32 `binary:"fixed32"`
	Uint64Ar      [4]uint64
	Uint64FixedAr [4]uint64 `binary:"fixed64"`
	UintAr        [4]uint
	StrAr         [4]string
	BytesAr       [4][]byte
	TimeAr        [4]time.Time
	DurationAr    [4]time.Duration
	EmptyAr       [4]EmptyStruct
}

type ByteAr

type ByteAr [4]byte

This will be encoded as message SomeName { bytes val = 1; }

type ByteSl

type ByteSl []byte

This will be encoded as message SomeName { bytes val = 1; }

type ComplexSt

type ComplexSt struct {
	PrField PrimitivesStruct
	ArField ArraysStruct
	SlField SlicesStruct
	PtField PointersStruct
}

type Concrete1

type Concrete1 struct{}

func (Concrete1) AssertInterface1

func (Concrete1) AssertInterface1()

func (Concrete1) AssertInterface2

func (Concrete1) AssertInterface2()

type Concrete2

type Concrete2 struct{}

func (Concrete2) AssertInterface1

func (Concrete2) AssertInterface1()

func (Concrete2) AssertInterface2

func (Concrete2) AssertInterface2()

type ConcreteTypeDef

type ConcreteTypeDef [4]byte

Special case: this concrete implementation (of Interface1) is a type definition.

func (ConcreteTypeDef) AssertInterface1

func (ConcreteTypeDef) AssertInterface1()

type ConcreteWrappedBytes

type ConcreteWrappedBytes struct {
	Value []byte
}

Ideally, user's of amino should refrain from using the above but wrap actual values in structs; e.g. like:

func (ConcreteWrappedBytes) AssertInterface1

func (ConcreteWrappedBytes) AssertInterface1()

type EmbeddedSt1

type EmbeddedSt1 struct {
	PrimitivesStruct
}

type EmbeddedSt4

type EmbeddedSt4 struct {
	Foo1 int
	PrimitivesStruct
	Foo2              string
	ArraysStructField ArraysStruct
	Foo3              []byte
	SlicesStruct
	Foo4                bool
	PointersStructField PointersStruct
	Foo5                uint
}

type EmbeddedSt5

type EmbeddedSt5 struct {
	Foo1 int
	*PrimitivesStruct
	Foo2              string
	ArraysStructField *ArraysStruct
	Foo3              []byte
	*SlicesStruct
	Foo4                bool
	PointersStructField *PointersStruct
	Foo5                uint
}

type EmptyStruct

type EmptyStruct struct{}

type IntAr

type IntAr [4]int

This will be encoded as message SomeName { repeated int val = 1; }

type IntDef

type IntDef int

This will be encoded as message SomeName { int64 val = 1; }

type IntSl

type IntSl []int

This will be encoded as message SomeName { repeated int val = 1; }

type Interface1

type Interface1 interface {
	AssertInterface1()
}

type Interface2

type Interface2 interface {
	AssertInterface2()
}

type InterfaceFieldsStruct

type InterfaceFieldsStruct struct {
	F1 Interface1
	F2 Interface1
	F3 interface{}
	F4 interface{}
}

Yet another special case: Field could be a type alias (should not be wrapped).

func (*InterfaceFieldsStruct) AssertInterface1

func (*InterfaceFieldsStruct) AssertInterface1()

type PointerSlicesStruct

type PointerSlicesStruct struct {
	Int8PtSl        []*int8
	Int16PtSl       []*int16
	Int32PtSl       []*int32
	Int32FixedPtSl  []*int32 `binary:"fixed32"`
	Int64PtSl       []*int64
	Int64FixedPtSl  []*int64 `binary:"fixed64"`
	IntPtSl         []*int
	BytePtSl        []*byte
	Uint8PtSl       []*uint8
	Uint16PtSl      []*uint16
	Uint32PtSl      []*uint32
	Uint32FixedPtSl []*uint32 `binary:"fixed32"`
	Uint64PtSl      []*uint64
	Uint64FixedPtSl []*uint64 `binary:"fixed64"`
	UintPtSl        []*uint
	StrPtSl         []*string
	BytesPtSl       []*[]byte
	TimePtSl        []*time.Time
	DurationPtSl    []*time.Duration
	EmptyPtSl       []*EmptyStruct
}

type PointersStruct

type PointersStruct struct {
	Int8Pt        *int8
	Int16Pt       *int16
	Int32Pt       *int32
	Int32FixedPt  *int32 `binary:"fixed32"`
	Int64Pt       *int64
	Int64FixedPt  *int64 `binary:"fixed64"`
	IntPt         *int
	BytePt        *byte
	Uint8Pt       *uint8
	Uint16Pt      *uint16
	Uint32Pt      *uint32
	Uint32FixedPt *uint32 `binary:"fixed32"`
	Uint64Pt      *uint64
	Uint64FixedPt *uint64 `binary:"fixed64"`
	UintPt        *uint
	StrPt         *string
	BytesPt       *[]byte
	TimePt        *time.Time
	DurationPt    *time.Duration
	EmptyPt       *EmptyStruct
}

type PrimitivesStruct

type PrimitivesStruct struct {
	Int8        int8
	Int16       int16
	Int32       int32
	Int32Fixed  int32 `binary:"fixed32"`
	Int64       int64
	Int64Fixed  int64 `binary:"fixed64"`
	Int         int
	Byte        byte
	Uint8       uint8
	Uint16      uint16
	Uint32      uint32
	Uint32Fixed uint32 `binary:"fixed32"`
	Uint64      uint64
	Uint64Fixed uint64 `binary:"fixed64"`
	Uint        uint
	Str         string
	Bytes       []byte
	Time        time.Time
	Duration    time.Duration
	Empty       EmptyStruct
}

type PrimitivesStructAr

type PrimitivesStructAr [2]PrimitivesStruct

This will be encoded as message SomeName { repeated PrimitivesStruct val = 1; }

type PrimitivesStructDef

type PrimitivesStructDef PrimitivesStruct

type PrimitivesStructSl

type PrimitivesStructSl []PrimitivesStruct

This will be encoded as message SomeName { repeated PrimitivesStruct val = 1; }

type ReprElem2

type ReprElem2 struct {
	Key   string
	Value interface{}
}

type ReprElem7

type ReprElem7 struct {
	A int8
}

func (ReprElem7) MarshalAmino

func (re ReprElem7) MarshalAmino() (uint8, error)

func (*ReprElem7) UnmarshalAmino

func (re *ReprElem7) UnmarshalAmino(u uint8) error

type ReprStruct1

type ReprStruct1 struct {
	C int64
	D int64
}

type ReprStruct4

type ReprStruct4 struct {
	A int32
}

type ShortArraysStruct

type ShortArraysStruct struct {
	TimeAr     [0]time.Time
	DurationAr [0]time.Duration
}

type SlicesSlicesStruct

type SlicesSlicesStruct struct {
	Int8SlSl        [][]int8
	Int16SlSl       [][]int16
	Int32SlSl       [][]int32
	Int32FixedSlSl  [][]int32 `binary:"fixed32"`
	Int64SlSl       [][]int64
	Int64FixedSlSl  [][]int64 `binary:"fixed64"`
	IntSlSl         [][]int
	ByteSlSl        [][]byte
	Uint8SlSl       [][]uint8
	Uint16SlSl      [][]uint16
	Uint32SlSl      [][]uint32
	Uint32FixedSlSl [][]uint32 `binary:"fixed32"`
	Uint64SlSl      [][]uint64
	Uint64FixedSlSl [][]uint64 `binary:"fixed64"`
	UintSlSl        [][]uint
	StrSlSl         [][]string
	BytesSlSl       [][][]byte
	TimeSlSl        [][]time.Time
	DurationSlSl    [][]time.Duration
	EmptySlSl       [][]EmptyStruct
}

type SlicesStruct

type SlicesStruct struct {
	Int8Sl        []int8
	Int16Sl       []int16
	Int32Sl       []int32
	Int32FixedSl  []int32 `binary:"fixed32"`
	Int64Sl       []int64
	Int64FixedSl  []int64 `binary:"fixed64"`
	IntSl         []int
	ByteSl        []byte
	Uint8Sl       []uint8
	Uint16Sl      []uint16
	Uint32Sl      []uint32
	Uint32FixedSl []uint32 `binary:"fixed32"`
	Uint64Sl      []uint64
	Uint64FixedSl []uint64 `binary:"fixed64"`
	UintSl        []uint
	StrSl         []string
	BytesSl       [][]byte
	TimeSl        []time.Time
	DurationSl    []time.Duration
	EmptySl       []EmptyStruct
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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