-
Notifications
You must be signed in to change notification settings - Fork 83
/
top_level_union.go
81 lines (58 loc) · 1.94 KB
/
top_level_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
// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
/*
* SOURCE:
* union.avsc
*/
package avro
import (
"errors"
"io"
"github.com/actgardner/gogen-avro/vm"
"github.com/actgardner/gogen-avro/vm/types"
)
type TopLevelUnionTypeEnum int
const (
TopLevelUnionTypeEnumIp_address TopLevelUnionTypeEnum = 0
TopLevelUnionTypeEnumEvent TopLevelUnionTypeEnum = 1
)
type TopLevelUnion struct {
Ip_address Ip_address
Event Event
UnionType TopLevelUnionTypeEnum
}
func writeTopLevelUnion(r TopLevelUnion, w io.Writer) error {
if err := vm.WriteLong(int64(r.UnionType), w); err != nil {
return err
}
switch r.UnionType{
case TopLevelUnionTypeEnumIp_address:
return writeIp_address(r.Ip_address, w)
case TopLevelUnionTypeEnumEvent:
return writeEvent(r.Event, w)
}
return errors.New("invalid value for TopLevelUnion")
}
func (_ *TopLevelUnion) SetBoolean(v bool) { panic("Unsupported operation") }
func (_ *TopLevelUnion) SetInt(v int32) { panic("Unsupported operation") }
func (_ *TopLevelUnion) SetFloat(v float32) { panic("Unsupported operation") }
func (_ *TopLevelUnion) SetDouble(v float64) { panic("Unsupported operation") }
func (_ *TopLevelUnion) SetBytes(v []byte) { panic("Unsupported operation") }
func (_ *TopLevelUnion) SetString(v string) { panic("Unsupported operation") }
func (r *TopLevelUnion) SetLong(v int64) {
r.UnionType = (TopLevelUnionTypeEnum)(v)
}
func (r *TopLevelUnion) Get(i int) types.Field {
switch (i) {
case 0:
return &r.Ip_address
case 1:
r.Event = Event{}
return &r.Event
}
panic("Unknown field index")
}
func (r *TopLevelUnion) Clear(i int) { panic("Unsupported operation") }
func (_ *TopLevelUnion) SetDefault(i int) { panic("Unsupported operation") }
func (_ *TopLevelUnion) AppendMap(key string) types.Field { panic("Unsupported operation") }
func (_ *TopLevelUnion) AppendArray() types.Field { panic("Unsupported operation") }
func (_ *TopLevelUnion) Finalize() { }