Files
noleader/.sqlx/query-976e720a4dee2911278524a199d6d5ece23f141e4b4c094efe5fc3123e376b04.json
kjuulh b1f43394d6
All checks were successful
continuous-integration/drone/push Build is passing
feat: add features for nats and postgres
2025-09-24 21:36:59 +02:00

44 lines
1.5 KiB
JSON

{
"db_name": "PostgreSQL",
"query": "\n INSERT INTO noleader_leaders (key, value, revision, heartbeat)\n VALUES ($1, $2, $3, now())\n ON CONFLICT (key)\n DO UPDATE SET\n value = EXCLUDED.value,\n revision = EXCLUDED.revision,\n heartbeat = now()\n WHERE \n (\n -- Normal case: revision matches (we're the current leader updating)\n noleader_leaders.revision = $4\n OR\n -- Override case: heartbeat is old (stale leader)\n noleader_leaders.heartbeat < now() - INTERVAL '60 seconds'\n )\n RETURNING value, revision\n ",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "value",
"type_info": "Text",
"origin": {
"Table": {
"table": "noleader_leaders",
"name": "value"
}
}
},
{
"ordinal": 1,
"name": "revision",
"type_info": "Int8",
"origin": {
"Table": {
"table": "noleader_leaders",
"name": "revision"
}
}
}
],
"parameters": {
"Left": [
"Text",
"Text",
"Int8",
"Int8"
]
},
"nullable": [
false,
false
]
},
"hash": "976e720a4dee2911278524a199d6d5ece23f141e4b4c094efe5fc3123e376b04"
}