github.com/hamba/avro/v2@v2.22.1-0.20240518180522-aff3955acf7d/types_test.go (about)

     1  package avro_test
     2  
     3  type TestInterface interface {
     4  	SomeFunc() int
     5  }
     6  
     7  type TestRecord struct {
     8  	A int64  `avro:"a"`
     9  	B string `avro:"b"`
    10  }
    11  
    12  func (*TestRecord) SomeFunc() int {
    13  	return 0
    14  }
    15  
    16  type TestPartialRecord struct {
    17  	B string `avro:"b"`
    18  }
    19  
    20  type TestNestedRecord struct {
    21  	A TestRecord `avro:"a"`
    22  	B TestRecord `avro:"b"`
    23  }
    24  
    25  type TestUnion struct {
    26  	A any `avro:"a"`
    27  }
    28  
    29  type TestEmbeddedRecord struct {
    30  	C string `avro:"c"`
    31  
    32  	TestEmbed // tests not-first position
    33  }
    34  
    35  type TestEmbeddedPtrRecord struct {
    36  	C string `avro:"c"`
    37  
    38  	*TestEmbed // tests not-first position
    39  }
    40  
    41  type TestEmbed struct {
    42  	A int64  `avro:"a"`
    43  	B string `avro:"b"`
    44  }
    45  
    46  type TestEmbedInt int
    47  
    48  type TestEmbeddedIntRecord struct {
    49  	B string `avro:"b"`
    50  
    51  	TestEmbedInt // tests not-first position
    52  }
    53  
    54  type TestUnexportedRecord struct {
    55  	A int64  `avro:"a"`
    56  	b string `avro:"b"`
    57  }