Documentation ¶
Index ¶
- Variables
- type AminoMarshalerInt4
- type AminoMarshalerInt5
- type AminoMarshalerStruct1
- type AminoMarshalerStruct2
- type AminoMarshalerStruct3
- type AminoMarshalerStruct6
- type AminoMarshalerStruct7
- type ArraysArraysStruct
- type ArraysStruct
- type ByteAr
- type ByteSl
- type ComplexSt
- type Concrete1
- type Concrete2
- type ConcreteTypeDef
- type ConcreteWrappedBytes
- type EmbeddedSt1
- type EmbeddedSt2
- type EmbeddedSt3
- type EmbeddedSt4
- type EmbeddedSt5
- type EmptyStruct
- type IntAr
- type IntDef
- type IntSl
- type Interface1
- type Interface2
- type InterfaceFieldsStruct
- type PointerSlicesStruct
- type PointersStruct
- type PrimitivesStruct
- type PrimitivesStructAr
- type PrimitivesStructDef
- type PrimitivesStructSl
- type ReprElem2
- type ReprElem7
- type ReprStruct1
- type ReprStruct4
- type ShortArraysStruct
- type SlicesSlicesStruct
- type SlicesStruct
Constants ¶
This section is empty.
Variables ¶
var DefTypes = []interface{}{ (*IntDef)(nil), (*IntAr)(nil), (*IntSl)(nil), (*ByteAr)(nil), (*ByteSl)(nil), (*PrimitivesStructSl)(nil), (*PrimitivesStructDef)(nil), }
var Package = pkg.NewPackage( "github.com/gnolang/gno/tm2/pkg/amino/tests", "tests", pkg.GetCallersDirname(), ).WithDependencies().WithTypes( EmptyStruct{}, PrimitivesStruct{}, ShortArraysStruct{}, ArraysStruct{}, ArraysArraysStruct{}, SlicesStruct{}, SlicesSlicesStruct{}, PointersStruct{}, PointerSlicesStruct{}, ComplexSt{}, EmbeddedSt1{}, EmbeddedSt2{}, EmbeddedSt3{}, EmbeddedSt4{}, pkg.Type{ Type: reflect.TypeOf(EmbeddedSt5{}), Name: "EmbeddedSt5NameOverride", PointerPreferred: false, }, AminoMarshalerStruct1{}, ReprStruct1{}, AminoMarshalerStruct2{}, ReprElem2{}, AminoMarshalerStruct3{}, AminoMarshalerInt4(0), AminoMarshalerInt5(0), AminoMarshalerStruct6{}, AminoMarshalerStruct7{}, ReprElem7{}, IntDef(0), IntAr{}, IntSl(nil), ByteAr{}, ByteSl(nil), PrimitivesStructDef{}, PrimitivesStructSl(nil), PrimitivesStructAr{}, Concrete1{}, Concrete2{}, ConcreteTypeDef{}, ConcreteWrappedBytes{}, &InterfaceFieldsStruct{}, )
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.
var StructTypes = []interface{}{ (*EmptyStruct)(nil), (*PrimitivesStruct)(nil), (*ShortArraysStruct)(nil), (*ArraysStruct)(nil), (*ArraysArraysStruct)(nil), (*SlicesStruct)(nil), (*SlicesSlicesStruct)(nil), (*PointersStruct)(nil), (*PointerSlicesStruct)(nil), (*ComplexSt)(nil), (*EmbeddedSt1)(nil), (*EmbeddedSt2)(nil), (*EmbeddedSt3)(nil), (*EmbeddedSt4)(nil), (*EmbeddedSt5)(nil), (*AminoMarshalerStruct1)(nil), (*AminoMarshalerStruct2)(nil), (*AminoMarshalerStruct3)(nil), (*AminoMarshalerInt4)(nil), (*AminoMarshalerInt5)(nil), (*AminoMarshalerStruct6)(nil), (*AminoMarshalerStruct7)(nil), }
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 ¶
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 ¶
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 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 EmbeddedSt2 ¶
type EmbeddedSt2 struct { PrimitivesStruct ArraysStruct SlicesStruct PointersStruct }
type EmbeddedSt3 ¶
type EmbeddedSt3 struct { *PrimitivesStruct *ArraysStruct *SlicesStruct *PointersStruct *EmptyStruct }
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 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 ReprElem7 ¶
type ReprElem7 struct {
A int8
}
func (ReprElem7) MarshalAmino ¶
func (*ReprElem7) UnmarshalAmino ¶
type ReprStruct1 ¶
type ReprStruct4 ¶
type ReprStruct4 struct {
A int32
}
type ShortArraysStruct ¶
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 }