{"id":22437835,"url":"https://github.com/lukasforst/exposed-upsert","last_synced_at":"2025-08-01T15:32:29.152Z","repository":{"id":42129649,"uuid":"245678045","full_name":"LukasForst/exposed-upsert","owner":"LukasForst","description":"PostgreSQL upsert for Exposed framework.","archived":false,"fork":false,"pushed_at":"2023-05-29T09:01:11.000Z","size":736,"stargazers_count":28,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-08T02:22:07.756Z","etag":null,"topics":["exposed","kotlin","postgresql-upsert"],"latest_commit_sha":null,"homepage":"https://exposed.forst.dev","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LukasForst.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-03-07T17:43:02.000Z","updated_at":"2025-01-26T09:26:17.000Z","dependencies_parsed_at":"2023-02-19T05:30:49.519Z","dependency_job_id":null,"html_url":"https://github.com/LukasForst/exposed-upsert","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/LukasForst/exposed-upsert","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasForst%2Fexposed-upsert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasForst%2Fexposed-upsert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasForst%2Fexposed-upsert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasForst%2Fexposed-upsert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LukasForst","download_url":"https://codeload.github.com/LukasForst/exposed-upsert/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LukasForst%2Fexposed-upsert/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268250821,"owners_count":24219958,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["exposed","kotlin","postgresql-upsert"],"created_at":"2024-12-06T00:15:09.943Z","updated_at":"2025-08-01T15:32:28.842Z","avatar_url":"https://github.com/LukasForst.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Exposed PostgreSQL Upsert\n\nUnfortunately, current [Exposed](https://github.com/JetBrains/Exposed) framework does not contain upsert \n(update or insert) functionality out of the box. \nThis simple extension library provides implementation for PostgreSQL.\nImplementation is based on the comment [Maxr1998](https://github.com/Maxr1998) made\n[here](https://github.com/JetBrains/Exposed/issues/167#issuecomment-480199613).\n\nUsage can be seen for example in [Wire Poll Bot here](https://github.com/wireapp/poll-bot/blob/fc74e2ae15691484714efe2b7803dbc5e235da01/src/main/kotlin/com/wire/bots/polls/dao/PollRepository.kt#L49)\n\nFollowing code tries to insert new value of `optionId` to `Votes` table where `pollId` and `userId` is composite key.\nIf the combination `pollId` and `userId` already exist, `optionId` is updated.\n```kotlin\nVotes.insertOrUpdate(Votes.pollId, Votes.userId) {\n    it[pollId] = pollAction.pollId\n    it[pollOption] = pollAction.optionId\n    it[userId] = pollAction.userId\n}\n```\n\nLibrary is hosted on Maven Central.\n```xml\n\u003cdependency\u003e\n\t\u003cgroupId\u003edev.forst\u003c/groupId\u003e\n\t\u003cartifactId\u003eexposed-upsert\u003c/artifactId\u003e\n\t\u003cversion\u003e1.3.4\u003c/version\u003e\n\u003c/dependency\u003e\n```\nGradle:\n```kotlin\nimplementation(\"dev.forst\", \"exposed-upsert\", \"1.3.4\")\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasforst%2Fexposed-upsert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukasforst%2Fexposed-upsert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukasforst%2Fexposed-upsert/lists"}