-
Notifications
You must be signed in to change notification settings - Fork 87
/
bodyworks_data.go
159 lines (110 loc) · 4.5 KB
/
bodyworks_data.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
/*
* SOURCE:
* namespace.avsc
*/
package avro
import (
"io"
"github.com/actgardner/gogen-avro/vm/types"
"github.com/actgardner/gogen-avro/vm"
"github.com/actgardner/gogen-avro/compiler"
)
// Common information related to the event which must be included in any clean event
type BodyworksData struct {
// Unique identifier for the event used for de-duplication and tracing.
Uuid *UnionNullBodyworksDatatypeUUID
// Fully qualified name of the host that generated the event that generated the data.
Hostname *UnionNullString
// Trace information not redundant with this object
Trace *UnionNullBodyworksTrace
}
func DeserializeBodyworksData(r io.Reader) (t BodyworksData, err error) {
deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema()))
if err == nil {
err = vm.Eval(r, deser, &t)
}
return
}
func DeserializeBodyworksDataFromSchema(r io.Reader, schema string) (t BodyworksData, err error) {
deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema()))
if err == nil {
err = vm.Eval(r, deser, &t)
}
return
}
func writeBodyworksData(r BodyworksData, w io.Writer) error {
var err error
err = writeUnionNullBodyworksDatatypeUUID( r.Uuid, w)
if err != nil {
return err
}
err = writeUnionNullString( r.Hostname, w)
if err != nil {
return err
}
err = writeUnionNullBodyworksTrace( r.Trace, w)
if err != nil {
return err
}
return err
}
func (r BodyworksData) Serialize(w io.Writer) error {
return writeBodyworksData(r, w)
}
func (r BodyworksData) Schema() string {
return "{\"doc\":\"Common information related to the event which must be included in any clean event\",\"fields\":[{\"default\":null,\"doc\":\"Unique identifier for the event used for de-duplication and tracing.\",\"name\":\"uuid\",\"type\":[\"null\",{\"doc\":\"A Universally Unique Identifier, in canonical form in lowercase. Example: de305d54-75b4-431b-adb2-eb6b9e546014\",\"fields\":[{\"default\":\"\",\"name\":\"uuid\",\"type\":\"string\"}],\"name\":\"UUID\",\"namespace\":\"bodyworks.datatype\",\"type\":\"record\"}]},{\"default\":null,\"doc\":\"Fully qualified name of the host that generated the event that generated the data.\",\"name\":\"hostname\",\"type\":[\"null\",\"string\"]},{\"default\":null,\"doc\":\"Trace information not redundant with this object\",\"name\":\"trace\",\"type\":[\"null\",{\"doc\":\"Trace\",\"fields\":[{\"default\":null,\"doc\":\"Trace Identifier\",\"name\":\"traceId\",\"type\":[\"null\",{\"doc\":\"A Universally Unique Identifier, in canonical form in lowercase. Example: de305d54-75b4-431b-adb2-eb6b9e546014\",\"fields\":[{\"default\":\"\",\"name\":\"uuid\",\"type\":\"string\"}],\"name\":\"UUID\",\"namespace\":\"headerworks.datatype\",\"type\":\"record\"}]}],\"name\":\"Trace\",\"type\":\"record\"}]}],\"name\":\"bodyworks.Data\",\"type\":\"record\"}"
}
func (r BodyworksData) SchemaName() string {
return "bodyworks.Data"
}
func (_ *BodyworksData) SetBoolean(v bool) { panic("Unsupported operation") }
func (_ *BodyworksData) SetInt(v int32) { panic("Unsupported operation") }
func (_ *BodyworksData) SetLong(v int64) { panic("Unsupported operation") }
func (_ *BodyworksData) SetFloat(v float32) { panic("Unsupported operation") }
func (_ *BodyworksData) SetDouble(v float64) { panic("Unsupported operation") }
func (_ *BodyworksData) SetBytes(v []byte) { panic("Unsupported operation") }
func (_ *BodyworksData) SetString(v string) { panic("Unsupported operation") }
func (_ *BodyworksData) SetUnionElem(v int64) { panic("Unsupported operation") }
func (r *BodyworksData) Get(i int) types.Field {
switch (i) {
case 0:
r.Uuid = &UnionNullBodyworksDatatypeUUID{}
return r.Uuid
case 1:
r.Hostname = &UnionNullString{}
return r.Hostname
case 2:
r.Trace = &UnionNullBodyworksTrace{}
return r.Trace
default:
panic("Unknown field index")
}
}
func (r *BodyworksData) SetDefault(i int) {
switch (i) {
case 0:
r.Uuid = nil
case 1:
r.Hostname = nil
case 2:
r.Trace = nil
default:
panic("Unknown field index")
}
}
func (r *BodyworksData) Clear(i int) {
switch (i) {
case 0:
r.Uuid = nil
case 1:
r.Hostname = nil
case 2:
r.Trace = nil
default:
panic("Non-optional field index")
}
}
func (_ *BodyworksData) AppendMap(key string) types.Field { panic("Unsupported operation") }
func (_ *BodyworksData) AppendArray() types.Field { panic("Unsupported operation") }
func (_ *BodyworksData) Finalize() { }