• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

GannettDigital / jstransform / 17108478813

20 Aug 2025 07:35PM UTC coverage: 33.717% (-3.4%) from 37.122%
17108478813

Pull #154

github

gannett-ggreer
Use "omitzero" for non-slice/non-pointer structure levels.

"omitempty" never did anything for those types anyway.
Pull Request #154: APIS-8302 - Use "omitzero" for non-slice/non-pointer structure levels.

11 of 23 new or added lines in 8 files covered. (47.83%)

1286 existing lines in 58 files now uncovered.

4833 of 14334 relevant lines covered (33.72%)

25.91 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/generate/avro_test_data/avro/complex/complex.go
1
// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
2
package complex
3

4
import (
5
        "github.com/actgardner/gogen-avro/v7/compiler"
6
        "github.com/actgardner/gogen-avro/v7/vm"
7
        "github.com/actgardner/gogen-avro/v7/vm/types"
8
        "io"
9
)
10

11
type Complex struct {
12
        // The timestamp when this avro data is written. Useful for identifying the newest row of data sharing keys.
13
        AvroWriteTime int64 `json:"AvroWriteTime"`
14
        // This is set to true when the Avro data is recording a delete in the source data.
15
        AvroDeleted bool `json:"AvroDeleted"`
16

17
        Contributors []*Contributors_record `json:"contributors"`
18

19
        Height *UnionNullLong `json:"height"`
20

21
        SomeDateObj *SomeDateObj_record `json:"someDateObj"`
22

23
        Visible bool `json:"visible"`
24

25
        Width *UnionNullDouble `json:"width"`
26

27
        Caption string `json:"caption"`
28

29
        Credit string `json:"credit"`
30

31
        Crops []*Crops_record `json:"crops"`
32

33
        Cutline *UnionNullString `json:"cutline"`
34

35
        DatePhotoTaken int64 `json:"datePhotoTaken"`
36

37
        Orientation string `json:"orientation"`
38

39
        OriginalSize *OriginalSize_record `json:"originalSize"`
40

41
        Type string `json:"type"`
42

43
        URL *URL_record `json:"URL"`
44
}
45

46
const ComplexAvroCRC64Fingerprint = "\x93\xbb\xa6z\xe2&z$"
47

UNCOV
48
func NewComplex() *Complex {
×
UNCOV
49
        return &Complex{}
×
UNCOV
50
}
×
51

52
func DeserializeComplex(r io.Reader) (*Complex, error) {
×
53
        t := NewComplex()
×
54
        deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema()))
×
55
        if err != nil {
×
56
                return nil, err
×
57
        }
×
58

59
        err = vm.Eval(r, deser, t)
×
60
        if err != nil {
×
61
                return nil, err
×
62
        }
×
63
        return t, err
×
64
}
65

UNCOV
66
func DeserializeComplexFromSchema(r io.Reader, schema string) (*Complex, error) {
×
UNCOV
67
        t := NewComplex()
×
UNCOV
68

×
UNCOV
69
        deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema()))
×
UNCOV
70
        if err != nil {
×
71
                return nil, err
×
72
        }
×
73

UNCOV
74
        err = vm.Eval(r, deser, t)
×
UNCOV
75
        if err != nil {
×
76
                return nil, err
×
77
        }
×
UNCOV
78
        return t, err
×
79
}
80

UNCOV
81
func writeComplex(r *Complex, w io.Writer) error {
×
UNCOV
82
        var err error
×
UNCOV
83
        err = vm.WriteLong(r.AvroWriteTime, w)
×
UNCOV
84
        if err != nil {
×
85
                return err
×
86
        }
×
UNCOV
87
        err = vm.WriteBool(r.AvroDeleted, w)
×
UNCOV
88
        if err != nil {
×
89
                return err
×
90
        }
×
UNCOV
91
        err = writeArrayContributors_record(r.Contributors, w)
×
UNCOV
92
        if err != nil {
×
93
                return err
×
94
        }
×
UNCOV
95
        err = writeUnionNullLong(r.Height, w)
×
UNCOV
96
        if err != nil {
×
97
                return err
×
98
        }
×
NEW
99
        err = writeSomeDateObj_record(r.SomeDateObj, w)
×
UNCOV
100
        if err != nil {
×
101
                return err
×
102
        }
×
UNCOV
103
        err = vm.WriteBool(r.Visible, w)
×
UNCOV
104
        if err != nil {
×
105
                return err
×
106
        }
×
UNCOV
107
        err = writeUnionNullDouble(r.Width, w)
×
UNCOV
108
        if err != nil {
×
109
                return err
×
110
        }
×
UNCOV
111
        err = vm.WriteString(r.Caption, w)
×
UNCOV
112
        if err != nil {
×
113
                return err
×
114
        }
×
UNCOV
115
        err = vm.WriteString(r.Credit, w)
×
UNCOV
116
        if err != nil {
×
117
                return err
×
118
        }
×
UNCOV
119
        err = writeArrayCrops_record(r.Crops, w)
×
UNCOV
120
        if err != nil {
×
121
                return err
×
122
        }
×
UNCOV
123
        err = writeUnionNullString(r.Cutline, w)
×
UNCOV
124
        if err != nil {
×
125
                return err
×
126
        }
×
UNCOV
127
        err = vm.WriteLong(r.DatePhotoTaken, w)
×
UNCOV
128
        if err != nil {
×
129
                return err
×
130
        }
×
UNCOV
131
        err = vm.WriteString(r.Orientation, w)
×
UNCOV
132
        if err != nil {
×
133
                return err
×
134
        }
×
UNCOV
135
        err = writeOriginalSize_record(r.OriginalSize, w)
×
UNCOV
136
        if err != nil {
×
137
                return err
×
138
        }
×
UNCOV
139
        err = vm.WriteString(r.Type, w)
×
UNCOV
140
        if err != nil {
×
141
                return err
×
142
        }
×
UNCOV
143
        err = writeURL_record(r.URL, w)
×
UNCOV
144
        if err != nil {
×
145
                return err
×
146
        }
×
UNCOV
147
        return err
×
148
}
149

UNCOV
150
func (r *Complex) Serialize(w io.Writer) error {
×
UNCOV
151
        return writeComplex(r, w)
×
UNCOV
152
}
×
153

UNCOV
154
func (r *Complex) Schema() string {
×
NEW
155
        return "{\"fields\":[{\"doc\":\"The timestamp when this avro data is written. Useful for identifying the newest row of data sharing keys.\",\"logicalType\":\"timestamp-millis\",\"name\":\"AvroWriteTime\",\"type\":\"long\"},{\"default\":false,\"doc\":\"This is set to true when the Avro data is recording a delete in the source data.\",\"name\":\"AvroDeleted\",\"type\":\"boolean\"},{\"name\":\"contributors\",\"namespace\":\"Simple\",\"type\":{\"items\":{\"fields\":[{\"name\":\"contributorId\",\"namespace\":\"Simple.contributors\",\"type\":[\"null\",\"string\"]},{\"name\":\"id\",\"namespace\":\"Simple.contributors\",\"type\":\"string\"},{\"name\":\"name\",\"namespace\":\"Simple.contributors\",\"type\":\"string\"}],\"name\":\"contributors_record\",\"namespace\":\"Simple.contributors\",\"type\":\"record\"},\"type\":\"array\"}},{\"name\":\"height\",\"namespace\":\"Simple\",\"type\":[\"null\",\"long\"]},{\"name\":\"someDateObj\",\"namespace\":\"Simple\",\"type\":{\"fields\":[{\"name\":\"dates\",\"namespace\":\"Simple.someDateObj\",\"type\":{\"items\":{\"logicalType\":\"timestamp-millis\",\"type\":\"long\"},\"type\":\"array\"}}],\"name\":\"someDateObj_record\",\"namespace\":\"Simple.someDateObj\",\"type\":\"record\"}},{\"default\":false,\"name\":\"visible\",\"namespace\":\"Simple\",\"type\":\"boolean\"},{\"name\":\"width\",\"namespace\":\"Simple\",\"type\":[\"null\",\"double\"]},{\"name\":\"caption\",\"type\":\"string\"},{\"name\":\"credit\",\"type\":\"string\"},{\"name\":\"crops\",\"type\":{\"items\":{\"fields\":[{\"name\":\"height\",\"namespace\":\"crops\",\"type\":\"double\"},{\"name\":\"name\",\"namespace\":\"crops\",\"type\":\"string\"},{\"name\":\"path\",\"namespace\":\"crops\",\"type\":\"string\"},{\"name\":\"relativePath\",\"namespace\":\"crops\",\"type\":\"string\"},{\"name\":\"width\",\"namespace\":\"crops\",\"type\":\"double\"}],\"name\":\"crops_record\",\"namespace\":\"crops\",\"type\":\"record\"},\"type\":\"array\"}},{\"name\":\"cutline\",\"type\":[\"null\",\"string\"]},{\"name\":\"datePhotoTaken\",\"type\":{\"logicalType\":\"timestamp-millis\",\"type\":\"long\"}},{\"name\":\"orientation\",\"type\":\"string\"},{\"name\":\"originalSize\",\"type\":{\"fields\":[{\"name\":\"height\",\"namespace\":\"originalSize\",\"type\":\"double\"},{\"name\":\"width\",\"namespace\":\"originalSize\",\"type\":\"double\"}],\"name\":\"originalSize_record\",\"namespace\":\"originalSize\",\"type\":\"record\"}},{\"name\":\"type\",\"type\":\"string\"},{\"name\":\"URL\",\"type\":{\"fields\":[{\"name\":\"absolute\",\"namespace\":\"URL\",\"type\":\"string\"},{\"name\":\"meta\",\"namespace\":\"URL\",\"type\":{\"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_record\",\"namespace\":\"URL\",\"type\":\"record\"}}],\"name\":\"Complex\",\"type\":\"record\"}"
×
UNCOV
156
}
×
157

158
func (r *Complex) SchemaName() string {
×
159
        return "Complex"
×
160
}
×
161

162
func (_ *Complex) SetBoolean(v bool)    { panic("Unsupported operation") }
×
163
func (_ *Complex) SetInt(v int32)       { panic("Unsupported operation") }
×
164
func (_ *Complex) SetLong(v int64)      { panic("Unsupported operation") }
×
165
func (_ *Complex) SetFloat(v float32)   { panic("Unsupported operation") }
×
166
func (_ *Complex) SetDouble(v float64)  { panic("Unsupported operation") }
×
167
func (_ *Complex) SetBytes(v []byte)    { panic("Unsupported operation") }
×
168
func (_ *Complex) SetString(v string)   { panic("Unsupported operation") }
×
169
func (_ *Complex) SetUnionElem(v int64) { panic("Unsupported operation") }
×
170

UNCOV
171
func (r *Complex) Get(i int) types.Field {
×
UNCOV
172
        switch i {
×
UNCOV
173
        case 0:
×
UNCOV
174
                return &types.Long{Target: &r.AvroWriteTime}
×
UNCOV
175
        case 1:
×
UNCOV
176
                return &types.Boolean{Target: &r.AvroDeleted}
×
UNCOV
177
        case 2:
×
UNCOV
178
                r.Contributors = make([]*Contributors_record, 0)
×
UNCOV
179

×
UNCOV
180
                return &ArrayContributors_recordWrapper{Target: &r.Contributors}
×
UNCOV
181
        case 3:
×
UNCOV
182
                r.Height = NewUnionNullLong()
×
UNCOV
183

×
UNCOV
184
                return r.Height
×
UNCOV
185
        case 4:
×
NEW
186
                r.SomeDateObj = NewSomeDateObj_record()
×
UNCOV
187

×
UNCOV
188
                return r.SomeDateObj
×
UNCOV
189
        case 5:
×
UNCOV
190
                return &types.Boolean{Target: &r.Visible}
×
UNCOV
191
        case 6:
×
UNCOV
192
                r.Width = NewUnionNullDouble()
×
UNCOV
193

×
UNCOV
194
                return r.Width
×
UNCOV
195
        case 7:
×
UNCOV
196
                return &types.String{Target: &r.Caption}
×
UNCOV
197
        case 8:
×
UNCOV
198
                return &types.String{Target: &r.Credit}
×
UNCOV
199
        case 9:
×
UNCOV
200
                r.Crops = make([]*Crops_record, 0)
×
UNCOV
201

×
UNCOV
202
                return &ArrayCrops_recordWrapper{Target: &r.Crops}
×
UNCOV
203
        case 10:
×
UNCOV
204
                r.Cutline = NewUnionNullString()
×
UNCOV
205

×
UNCOV
206
                return r.Cutline
×
UNCOV
207
        case 11:
×
UNCOV
208
                return &types.Long{Target: &r.DatePhotoTaken}
×
UNCOV
209
        case 12:
×
UNCOV
210
                return &types.String{Target: &r.Orientation}
×
UNCOV
211
        case 13:
×
UNCOV
212
                r.OriginalSize = NewOriginalSize_record()
×
UNCOV
213

×
UNCOV
214
                return r.OriginalSize
×
UNCOV
215
        case 14:
×
UNCOV
216
                return &types.String{Target: &r.Type}
×
UNCOV
217
        case 15:
×
UNCOV
218
                r.URL = NewURL_record()
×
UNCOV
219

×
UNCOV
220
                return r.URL
×
221
        }
222
        panic("Unknown field index")
×
223
}
224

225
func (r *Complex) SetDefault(i int) {
×
226
        switch i {
×
227
        case 1:
×
228
                r.AvroDeleted = false
×
229
                return
×
230
        case 5:
×
231
                r.Visible = false
×
232
                return
×
233
        }
234
        panic("Unknown field index")
×
235
}
236

UNCOV
237
func (r *Complex) NullField(i int) {
×
UNCOV
238
        switch i {
×
239
        case 3:
×
240
                r.Height = nil
×
241
                return
×
UNCOV
242
        case 6:
×
UNCOV
243
                r.Width = nil
×
244
                return
×
245
        case 10:
×
246
                r.Cutline = nil
×
247
                return
×
248
        }
249
        panic("Not a nullable field index")
×
250
}
251

252
func (_ *Complex) AppendMap(key string) types.Field { panic("Unsupported operation") }
×
253
func (_ *Complex) AppendArray() types.Field         { panic("Unsupported operation") }
×
254
func (_ *Complex) Finalize()                        {}
×
255

256
func (_ *Complex) AvroCRC64Fingerprint() []byte {
×
257
        return []byte(ComplexAvroCRC64Fingerprint)
×
258
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc