hashFields computes the hash of all field values.
(values []any)
| 260 | |
| 261 | // hashFields computes the hash of all field values. |
| 262 | func hashFields(values []any) string { |
| 263 | buf := make([]byte, 0) |
| 264 | for _, v := range values { |
| 265 | switch val := v.(type) { |
| 266 | case uint8: |
| 267 | buf = append(buf, val) |
| 268 | case uint16: |
| 269 | buf = append(buf, bytes.WriteUint16(val)...) |
| 270 | case uint32: |
| 271 | buf = append(buf, bytes.WriteUint32(val)...) |
| 272 | case uint64: |
| 273 | buf = append(buf, bytes.WriteUint64(val)...) |
| 274 | case int8: |
| 275 | buf = append(buf, byte(val)) |
| 276 | case int16: |
| 277 | buf = append(buf, bytes.WriteUint16(uint16(val))...) |
| 278 | case int32: |
| 279 | buf = append(buf, bytes.WriteUint32(uint32(val))...) |
| 280 | case int64: |
| 281 | buf = append(buf, bytes.WriteUint64(uint64(val))...) |
| 282 | case int: |
| 283 | buf = append(buf, bytes.WriteUint64(uint64(val))...) |
| 284 | case uint: |
| 285 | buf = append(buf, bytes.WriteUint64(uint64(val))...) |
| 286 | case string: |
| 287 | buf = append(buf, val...) |
| 288 | case net.IP: |
| 289 | buf = append(buf, val...) |
| 290 | } |
| 291 | } |
| 292 | return hex.EncodeToString(buf) |
| 293 | } |
| 294 | |
| 295 | func joinsEqual(joins []bool) bool { |
| 296 | for _, j := range joins { |
no test coverage detected