-
Notifications
You must be signed in to change notification settings - Fork 6
/
url_record.go
127 lines (105 loc) · 3.47 KB
/
url_record.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
// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
package complex
import (
"github.com/actgardner/gogen-avro/v7/compiler"
"github.com/actgardner/gogen-avro/v7/vm"
"github.com/actgardner/gogen-avro/v7/vm/types"
"io"
)
type URL_record struct {
Absolute string `json:"absolute"`
Meta *UnionNullMeta_record `json:"meta"`
Publish string `json:"publish"`
}
const URL_recordAvroCRC64Fingerprint = "\x01\xe05\xab[+r6"
func NewURL_record() *URL_record {
return &URL_record{}
}
func DeserializeURL_record(r io.Reader) (*URL_record, error) {
t := NewURL_record()
deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema()))
if err != nil {
return nil, err
}
err = vm.Eval(r, deser, t)
if err != nil {
return nil, err
}
return t, err
}
func DeserializeURL_recordFromSchema(r io.Reader, schema string) (*URL_record, error) {
t := NewURL_record()
deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema()))
if err != nil {
return nil, err
}
err = vm.Eval(r, deser, t)
if err != nil {
return nil, err
}
return t, err
}
func writeURL_record(r *URL_record, w io.Writer) error {
var err error
err = vm.WriteString(r.Absolute, w)
if err != nil {
return err
}
err = writeUnionNullMeta_record(r.Meta, w)
if err != nil {
return err
}
err = vm.WriteString(r.Publish, w)
if err != nil {
return err
}
return err
}
func (r *URL_record) Serialize(w io.Writer) error {
return writeURL_record(r, w)
}
func (r *URL_record) Schema() string {
return "{\"fields\":[{\"name\":\"absolute\",\"namespace\":\"URL\",\"type\":\"string\"},{\"name\":\"meta\",\"namespace\":\"URL\",\"type\":[\"null\",{\"fields\":[{\"name\":\"description\",\"namespace\":\"URL.meta\",\"type\":\"string\"},{\"name\":\"siteName\",\"namespace\":\"URL.meta\",\"type\":\"string\"}],\"name\":\"meta_record\",\"namespace\":\"URL.meta\",\"type\":\"record\"}]},{\"name\":\"publish\",\"namespace\":\"URL\",\"type\":\"string\"}],\"name\":\"URL.URL_record\",\"type\":\"record\"}"
}
func (r *URL_record) SchemaName() string {
return "URL.URL_record"
}
func (_ *URL_record) SetBoolean(v bool) { panic("Unsupported operation") }
func (_ *URL_record) SetInt(v int32) { panic("Unsupported operation") }
func (_ *URL_record) SetLong(v int64) { panic("Unsupported operation") }
func (_ *URL_record) SetFloat(v float32) { panic("Unsupported operation") }
func (_ *URL_record) SetDouble(v float64) { panic("Unsupported operation") }
func (_ *URL_record) SetBytes(v []byte) { panic("Unsupported operation") }
func (_ *URL_record) SetString(v string) { panic("Unsupported operation") }
func (_ *URL_record) SetUnionElem(v int64) { panic("Unsupported operation") }
func (r *URL_record) Get(i int) types.Field {
switch i {
case 0:
return &types.String{Target: &r.Absolute}
case 1:
r.Meta = NewUnionNullMeta_record()
return r.Meta
case 2:
return &types.String{Target: &r.Publish}
}
panic("Unknown field index")
}
func (r *URL_record) SetDefault(i int) {
switch i {
}
panic("Unknown field index")
}
func (r *URL_record) NullField(i int) {
switch i {
case 1:
r.Meta = nil
return
}
panic("Not a nullable field index")
}
func (_ *URL_record) AppendMap(key string) types.Field { panic("Unsupported operation") }
func (_ *URL_record) AppendArray() types.Field { panic("Unsupported operation") }
func (_ *URL_record) Finalize() {}
func (_ *URL_record) AvroCRC64Fingerprint() []byte {
return []byte(URL_recordAvroCRC64Fingerprint)
}