defaultAccessorValue provides the default value for the field. This value is typically assigned when the accessor returns an error or nil value, but the map valuer must contain the resolved field name in case of filters using the not operator.
(field Field)
| 259 | // error or nil value, but the map valuer must contain the resolved |
| 260 | // field name in case of filters using the not operator. |
| 261 | func defaultAccessorValue(field Field) any { |
| 262 | switch field.Name.Type() { |
| 263 | case params.Uint8, params.Int64, params.Int8, params.Int32, params.Int16, |
| 264 | params.Uint16, params.Port, params.Uint32, params.Uint64, params.PID, |
| 265 | params.TID, params.Flags, params.Flags64: |
| 266 | return 0 |
| 267 | case params.Float, params.Double: |
| 268 | return 0.0 |
| 269 | case params.Time: |
| 270 | return zeroTime |
| 271 | case params.Bool: |
| 272 | return false |
| 273 | case params.IP, params.IPv4, params.IPv6: |
| 274 | return zeroIP |
| 275 | case params.Binary: |
| 276 | return zeroByte |
| 277 | case params.Slice: |
| 278 | return zeroSlice |
| 279 | default: |
| 280 | return "" |
| 281 | } |
| 282 | } |
no test coverage detected