ufoss-org / kotysa

The idiomatic way to write type-safe SQL in Kotlin
The Unlicense
116 stars 1 forks source link

Support upsert functionality #58

Open dzikoysk opened 3 years ago

dzikoysk commented 3 years ago

At this moment I don't think it is possible to use upsert functionality using a DSL. It's quite useful as most of the popular SQL implementations somehow support this:

MySQL, MariaDB, H2 (with MySQL dialect): ON DUPLICATE KEY UPDATE ... PostgreSQL, SQLite: ON CONFLICT [ON CONSTRAINT] ...

pull-vert commented 3 years ago

Interesting, I will give it a try !

dzikoysk commented 3 years ago

Not sure if it might be helpful, but it's something I had to deal with in Exposed as it's still not supported oficially. Here's my implementation:

You may see how to deal with it in various DBs implementations and how it is supported these days 🤔