/
bytes.go
90 lines (69 loc) · 1.87 KB
/
bytes.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
// Code generated by github.com/actgardner/gogen-avro/v10. DO NOT EDIT.
/*
* SOURCE:
* example.avsc
*/
package test
import (
"encoding/json"
"github.com/actgardner/gogen-avro/v10/util"
"github.com/actgardner/gogen-avro/v10/vm/types"
)
type Bytes []byte
func (b *Bytes) UnmarshalJSON(data []byte) error {
var s string
if err := json.Unmarshal(data, &s); err != nil {
return err
}
*b = util.DecodeByteString(s)
return nil
}
func (b Bytes) MarshalJSON() ([]byte, error) {
return []byte(util.EncodeByteString(b)), nil
}
type BytesWrapper struct {
Target *Bytes
}
func (b BytesWrapper) SetBoolean(v bool) {
panic("Unable to assign bytes to bytes field")
}
func (b BytesWrapper) SetInt(v int32) {
panic("Unable to assign int to bytes field")
}
func (b BytesWrapper) SetLong(v int64) {
panic("Unable to assign long to bytes field")
}
func (b BytesWrapper) SetFloat(v float32) {
panic("Unable to assign float to bytes field")
}
func (b BytesWrapper) SetDouble(v float64) {
panic("Unable to assign double to bytes field")
}
func (b BytesWrapper) SetUnionElem(v int64) {
panic("Unable to assign union elem to bytes field")
}
func (b BytesWrapper) SetBytes(v []byte) {
*(b.Target) = v
}
func (b BytesWrapper) SetString(v string) {
*(b.Target) = []byte(v)
}
func (b BytesWrapper) Get(i int) types.Field {
panic("Unable to get field from bytes field")
}
func (b BytesWrapper) SetDefault(i int) {
panic("Unable to set default on bytes field")
}
func (b BytesWrapper) AppendMap(key string) types.Field {
panic("Unable to append map key to from bytes field")
}
func (b BytesWrapper) AppendArray() types.Field {
panic("Unable to append array element to from bytes field")
}
func (b BytesWrapper) NullField(int) {
panic("Unable to null field in bytes field")
}
func (b BytesWrapper) HintSize(int) {
panic("Unable to hint size in bytes field")
}
func (b BytesWrapper) Finalize() {}