hashKey turns an opaque string key into the int64 that pg_advisory_lock expects. FNV-1a gives a stable, well-distributed mapping with effectively no collision risk for the handful of named locks this package uses.
(key string)
| 95 | // mapping with effectively no collision risk for the handful of named |
| 96 | // locks this package uses. |
| 97 | func hashKey(key string) int64 { |
| 98 | h := fnv.New64a() |
| 99 | _, _ = h.Write([]byte(key)) |
| 100 | return int64(h.Sum64()) //nolint:gosec // intentional wraparound; pg accepts any int64 |
| 101 | } |