-
Notifications
You must be signed in to change notification settings - Fork 84
/
datatype_uuid.go
106 lines (80 loc) · 2.7 KB
/
datatype_uuid.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
// 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"
)
// A Universally Unique Identifier, in canonical form in lowercase. Example: de305d54-75b4-431b-adb2-eb6b9e546014
type DatatypeUUID struct {
Uuid string
}
func DeserializeDatatypeUUID(r io.Reader) (t DatatypeUUID, err error) {
deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema()))
if err == nil {
err = vm.Eval(r, deser, &t)
}
return
}
func DeserializeDatatypeUUIDFromSchema(r io.Reader, schema string) (t DatatypeUUID, err error) {
deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema()))
if err == nil {
err = vm.Eval(r, deser, &t)
}
return
}
func writeDatatypeUUID(r DatatypeUUID, w io.Writer) error {
var err error
err = vm.WriteString( r.Uuid, w)
if err != nil {
return err
}
return err
}
func (r DatatypeUUID) Serialize(w io.Writer) error {
return writeDatatypeUUID(r, w)
}
func (r DatatypeUUID) Schema() string {
return "{\"doc\":\"A Universally Unique Identifier, in canonical form in lowercase. Example: de305d54-75b4-431b-adb2-eb6b9e546014\",\"fields\":[{\"default\":\"\",\"name\":\"uuid\",\"type\":\"string\"}],\"name\":\"headerworks.datatype.UUID\",\"type\":\"record\"}"
}
func (r DatatypeUUID) SchemaName() string {
return "headerworks.datatype.UUID"
}
func (_ *DatatypeUUID) SetBoolean(v bool) { panic("Unsupported operation") }
func (_ *DatatypeUUID) SetInt(v int32) { panic("Unsupported operation") }
func (_ *DatatypeUUID) SetLong(v int64) { panic("Unsupported operation") }
func (_ *DatatypeUUID) SetFloat(v float32) { panic("Unsupported operation") }
func (_ *DatatypeUUID) SetDouble(v float64) { panic("Unsupported operation") }
func (_ *DatatypeUUID) SetBytes(v []byte) { panic("Unsupported operation") }
func (_ *DatatypeUUID) SetString(v string) { panic("Unsupported operation") }
func (_ *DatatypeUUID) SetUnionElem(v int64) { panic("Unsupported operation") }
func (r *DatatypeUUID) Get(i int) types.Field {
switch (i) {
case 0:
return (*types.String)(&r.Uuid)
default:
panic("Unknown field index")
}
}
func (r *DatatypeUUID) SetDefault(i int) {
switch (i) {
case 0:
r.Uuid = ""
default:
panic("Unknown field index")
}
}
func (r *DatatypeUUID) Clear(i int) {
switch (i) {
default:
panic("Non-optional field index")
}
}
func (_ *DatatypeUUID) AppendMap(key string) types.Field { panic("Unsupported operation") }
func (_ *DatatypeUUID) AppendArray() types.Field { panic("Unsupported operation") }
func (_ *DatatypeUUID) Finalize() { }