• 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/nonest/avro/simple/simple.go
1
// Code generated by github.com/actgardner/gogen-avro. DO NOT EDIT.
2
package simple
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 Simple 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 *UnionNullSomeDateObj_record `json:"someDateObj"`
22

23
        Type string `json:"type"`
24

25
        Visible bool `json:"visible"`
26

27
        Width *UnionNullDouble `json:"width"`
28
}
29

30
const SimpleAvroCRC64Fingerprint = "\xe8\xb3ا׳\b\xde"
31

UNCOV
32
func NewSimple() *Simple {
×
UNCOV
33
        return &Simple{}
×
UNCOV
34
}
×
35

36
func DeserializeSimple(r io.Reader) (*Simple, error) {
×
37
        t := NewSimple()
×
38
        deser, err := compiler.CompileSchemaBytes([]byte(t.Schema()), []byte(t.Schema()))
×
39
        if err != nil {
×
40
                return nil, err
×
41
        }
×
42

43
        err = vm.Eval(r, deser, t)
×
44
        if err != nil {
×
45
                return nil, err
×
46
        }
×
47
        return t, err
×
48
}
49

UNCOV
50
func DeserializeSimpleFromSchema(r io.Reader, schema string) (*Simple, error) {
×
UNCOV
51
        t := NewSimple()
×
UNCOV
52

×
UNCOV
53
        deser, err := compiler.CompileSchemaBytes([]byte(schema), []byte(t.Schema()))
×
UNCOV
54
        if err != nil {
×
55
                return nil, err
×
56
        }
×
57

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

UNCOV
65
func writeSimple(r *Simple, w io.Writer) error {
×
UNCOV
66
        var err error
×
UNCOV
67
        err = vm.WriteLong(r.AvroWriteTime, w)
×
UNCOV
68
        if err != nil {
×
69
                return err
×
70
        }
×
UNCOV
71
        err = vm.WriteBool(r.AvroDeleted, w)
×
UNCOV
72
        if err != nil {
×
73
                return err
×
74
        }
×
UNCOV
75
        err = writeArrayContributors_record(r.Contributors, w)
×
UNCOV
76
        if err != nil {
×
77
                return err
×
78
        }
×
UNCOV
79
        err = writeUnionNullLong(r.Height, w)
×
UNCOV
80
        if err != nil {
×
81
                return err
×
82
        }
×
UNCOV
83
        err = writeUnionNullSomeDateObj_record(r.SomeDateObj, w)
×
UNCOV
84
        if err != nil {
×
85
                return err
×
86
        }
×
UNCOV
87
        err = vm.WriteString(r.Type, w)
×
UNCOV
88
        if err != nil {
×
89
                return err
×
90
        }
×
UNCOV
91
        err = vm.WriteBool(r.Visible, w)
×
UNCOV
92
        if err != nil {
×
93
                return err
×
94
        }
×
UNCOV
95
        err = writeUnionNullDouble(r.Width, w)
×
UNCOV
96
        if err != nil {
×
97
                return err
×
98
        }
×
UNCOV
99
        return err
×
100
}
101

UNCOV
102
func (r *Simple) Serialize(w io.Writer) error {
×
UNCOV
103
        return writeSimple(r, w)
×
UNCOV
104
}
×
105

UNCOV
106
func (r *Simple) Schema() string {
×
UNCOV
107
        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\",\"type\":{\"items\":{\"fields\":[{\"name\":\"contributorId\",\"namespace\":\"contributors\",\"type\":[\"null\",\"string\"]},{\"name\":\"id\",\"namespace\":\"contributors\",\"type\":\"string\"},{\"name\":\"name\",\"namespace\":\"contributors\",\"type\":\"string\"}],\"name\":\"contributors_record\",\"namespace\":\"contributors\",\"type\":\"record\"},\"type\":\"array\"}},{\"name\":\"height\",\"type\":[\"null\",\"long\"]},{\"name\":\"someDateObj\",\"type\":[\"null\",{\"fields\":[{\"name\":\"dates\",\"namespace\":\"someDateObj\",\"type\":{\"items\":{\"logicalType\":\"timestamp-millis\",\"type\":\"long\"},\"type\":\"array\"}}],\"name\":\"someDateObj_record\",\"namespace\":\"someDateObj\",\"type\":\"record\"}]},{\"name\":\"type\",\"type\":\"string\"},{\"default\":false,\"name\":\"visible\",\"type\":\"boolean\"},{\"name\":\"width\",\"type\":[\"null\",\"double\"]}],\"name\":\"Simple\",\"type\":\"record\"}"
×
UNCOV
108
}
×
109

110
func (r *Simple) SchemaName() string {
×
111
        return "Simple"
×
112
}
×
113

114
func (_ *Simple) SetBoolean(v bool)    { panic("Unsupported operation") }
×
115
func (_ *Simple) SetInt(v int32)       { panic("Unsupported operation") }
×
116
func (_ *Simple) SetLong(v int64)      { panic("Unsupported operation") }
×
117
func (_ *Simple) SetFloat(v float32)   { panic("Unsupported operation") }
×
118
func (_ *Simple) SetDouble(v float64)  { panic("Unsupported operation") }
×
119
func (_ *Simple) SetBytes(v []byte)    { panic("Unsupported operation") }
×
120
func (_ *Simple) SetString(v string)   { panic("Unsupported operation") }
×
121
func (_ *Simple) SetUnionElem(v int64) { panic("Unsupported operation") }
×
122

UNCOV
123
func (r *Simple) Get(i int) types.Field {
×
UNCOV
124
        switch i {
×
UNCOV
125
        case 0:
×
UNCOV
126
                return &types.Long{Target: &r.AvroWriteTime}
×
UNCOV
127
        case 1:
×
UNCOV
128
                return &types.Boolean{Target: &r.AvroDeleted}
×
UNCOV
129
        case 2:
×
UNCOV
130
                r.Contributors = make([]*Contributors_record, 0)
×
UNCOV
131

×
UNCOV
132
                return &ArrayContributors_recordWrapper{Target: &r.Contributors}
×
UNCOV
133
        case 3:
×
UNCOV
134
                r.Height = NewUnionNullLong()
×
UNCOV
135

×
UNCOV
136
                return r.Height
×
UNCOV
137
        case 4:
×
UNCOV
138
                r.SomeDateObj = NewUnionNullSomeDateObj_record()
×
UNCOV
139

×
UNCOV
140
                return r.SomeDateObj
×
UNCOV
141
        case 5:
×
UNCOV
142
                return &types.String{Target: &r.Type}
×
UNCOV
143
        case 6:
×
UNCOV
144
                return &types.Boolean{Target: &r.Visible}
×
UNCOV
145
        case 7:
×
UNCOV
146
                r.Width = NewUnionNullDouble()
×
UNCOV
147

×
UNCOV
148
                return r.Width
×
149
        }
150
        panic("Unknown field index")
×
151
}
152

153
func (r *Simple) SetDefault(i int) {
×
154
        switch i {
×
155
        case 1:
×
156
                r.AvroDeleted = false
×
157
                return
×
158
        case 6:
×
159
                r.Visible = false
×
160
                return
×
161
        }
162
        panic("Unknown field index")
×
163
}
164

165
func (r *Simple) NullField(i int) {
×
166
        switch i {
×
167
        case 3:
×
168
                r.Height = nil
×
169
                return
×
170
        case 4:
×
171
                r.SomeDateObj = nil
×
172
                return
×
173
        case 7:
×
174
                r.Width = nil
×
175
                return
×
176
        }
177
        panic("Not a nullable field index")
×
178
}
179

180
func (_ *Simple) AppendMap(key string) types.Field { panic("Unsupported operation") }
×
181
func (_ *Simple) AppendArray() types.Field         { panic("Unsupported operation") }
×
182
func (_ *Simple) Finalize()                        {}
×
183

184
func (_ *Simple) AvroCRC64Fingerprint() []byte {
×
185
        return []byte(SimpleAvroCRC64Fingerprint)
×
186
}
×
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