Skip to content

Instantly share code, notes, and snippets.

@KadekM
Created March 17, 2021 15:07
Show Gist options
  • Save KadekM/5c0cd96b9a0cab1c87249ad90974f2dc to your computer and use it in GitHub Desktop.
Save KadekM/5c0cd96b9a0cab1c87249ad90974f2dc to your computer and use it in GitHub Desktop.
def updatePartitionCommand(partitions: List[(String, Long)]) = {
val enc = (varchar ~ int8).values.list(partitions)
sql"""INSERT INTO offsets (topic, "offset")
VALUES $enc
ON CONFLICT (topic) DO UPDATE
SET "offset"=EXCLUDED."offset"""".command
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment