Commit 17a3fb5
authored
feat: OmitZero and OmitEmpty (#30)
This splits OmitEmpty into OmitEmpty and OmitZero. OmitEmpty will omit
anything that is zero as well as a slice and map of length 0.
OmitZero only omits the zero type, either by checking the return value
of the IsZero method or if that's not implemented by
reflect.Value.IsZero. This by default retains the empty map and slice,
since initialised but 0-length maps and slices are not zero.1 parent 4aa10a4 commit 17a3fb5
2 files changed
+60
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
67 | 84 | | |
68 | 85 | | |
69 | 86 | | |
| |||
95 | 112 | | |
96 | 113 | | |
97 | 114 | | |
| 115 | + | |
98 | 116 | | |
99 | 117 | | |
100 | 118 | | |
| |||
110 | 128 | | |
111 | 129 | | |
112 | 130 | | |
| 131 | + | |
113 | 132 | | |
114 | 133 | | |
115 | 134 | | |
| |||
118 | 137 | | |
119 | 138 | | |
120 | 139 | | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
121 | 146 | | |
122 | 147 | | |
123 | 148 | | |
| |||
261 | 286 | | |
262 | 287 | | |
263 | 288 | | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
264 | 294 | | |
265 | 295 | | |
266 | 296 | | |
267 | 297 | | |
268 | 298 | | |
| 299 | + | |
269 | 300 | | |
270 | 301 | | |
271 | 302 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 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 | + | |
60 | 88 | | |
61 | 89 | | |
62 | 90 | | |
| |||
0 commit comments