github.com/hamba/avro@v1.8.0/example_resolver_test.go (about) 1 package avro_test 2 3 import ( 4 "fmt" 5 "log" 6 7 "github.com/hamba/avro" 8 ) 9 10 func ExampleRegister() { 11 data := []byte{0x02, 0x02} // Your Avro data here 12 schema := avro.MustParse(`["null", {"type":"enum", "name": "test", "symbols": ["A", "B"]}]`) 13 14 avro.Register("test", "") // Register the name test as a string type 15 16 var result interface{} 17 err := avro.Unmarshal(schema, data, &result) 18 if err != nil { 19 log.Fatal(err) 20 } 21 22 fmt.Println(result) 23 24 //Output: B 25 }