/
recursive_field_union.go
88 lines (61 loc) · 2.27 KB
/
recursive_field_union.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
/*
* SOURCE:
* recursive.avsc
*/
package avro
import (
"io"
"fmt"
"github.com/actgardner/gogen-avro/vm"
"github.com/actgardner/gogen-avro/vm/types"
)
type RecursiveFieldUnionTypeEnum int
const (
RecursiveFieldUnionTypeEnumNull RecursiveFieldUnionTypeEnum = 0
RecursiveFieldUnionTypeEnumRecursiveUnionTestRecord RecursiveFieldUnionTypeEnum = 1
)
type RecursiveFieldUnion struct {
Null *types.NullVal
RecursiveUnionTestRecord *RecursiveUnionTestRecord
UnionType RecursiveFieldUnionTypeEnum
}
func writeRecursiveFieldUnion(r *RecursiveFieldUnion, w io.Writer) error {
err := vm.WriteLong(int64(r.UnionType), w)
if err != nil {
return err
}
switch r.UnionType{
case RecursiveFieldUnionTypeEnumNull:
return vm.WriteNull(r.Null, w)
case RecursiveFieldUnionTypeEnumRecursiveUnionTestRecord:
return writeRecursiveUnionTestRecord(r.RecursiveUnionTestRecord, w)
}
return fmt.Errorf("invalid value for *RecursiveFieldUnion")
}
func NewRecursiveFieldUnion() *RecursiveFieldUnion {
return &RecursiveFieldUnion{}
}
func (_ *RecursiveFieldUnion) SetBoolean(v bool) { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) SetInt(v int32) { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) SetFloat(v float32) { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) SetDouble(v float64) { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) SetBytes(v []byte) { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) SetString(v string) { panic("Unsupported operation") }
func (r *RecursiveFieldUnion) SetLong(v int64) {
r.UnionType = (RecursiveFieldUnionTypeEnum)(v)
}
func (r *RecursiveFieldUnion) Get(i int) types.Field {
switch (i) {
case 0:
return r.Null
case 1:
r.RecursiveUnionTestRecord = NewRecursiveUnionTestRecord()
return r.RecursiveUnionTestRecord
}
panic("Unknown field index")
}
func (_ *RecursiveFieldUnion) SetDefault(i int) { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) AppendMap(key string) types.Field { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) AppendArray() types.Field { panic("Unsupported operation") }
func (_ *RecursiveFieldUnion) Finalize() { }