github.com/hamba/avro/v2@v2.22.1-0.20240518180522-aff3955acf7d/cmd/avrogen/testdata/golden_encoders.go (about)

     1  package testpkg
     2  
     3  // Code generated by avro/gen. DO NOT EDIT.
     4  
     5  import (
     6  	"github.com/hamba/avro/v2"
     7  )
     8  
     9  // Test is a generated struct.
    10  type Test struct {
    11  	SomeString string `avro:"someString"`
    12  	SomeInt    int    `avro:"someInt"`
    13  }
    14  
    15  var schemaTest = avro.MustParse(`{"name":"a.b.test","type":"record","fields":[{"name":"someString","type":"string"},{"name":"someInt","type":"int"}]}`)
    16  
    17  // Schema returns the schema for Test.
    18  func (o *Test) Schema() avro.Schema {
    19  	return schemaTest
    20  }
    21  
    22  // Unmarshal decodes b into the receiver.
    23  func (o *Test) Unmarshal(b []byte) error {
    24  	return avro.Unmarshal(o.Schema(), b, o)
    25  }
    26  
    27  // Marshal encodes the receiver.
    28  func (o *Test) Marshal() ([]byte, error) {
    29  	return avro.Marshal(o.Schema(), o)
    30  }