The future of Kotlin/Native is not certain but there are already a few great libraries that are compatible with it. When it comes to databases, many Android developers choose a library called Room. It works pretty well, which is a rare quality for a mobile ORM solution. The problem is, its scope is limited to Android.
That encouraged me to look for an alternative, and I’ve decided to give SQLDelight a go. I must say, it’s probably the best ORM solution I ever saw. It doesn’t try to hide SQL queries, and it validates them immediately as you type them, which means less surprises on runtime. All you have to do is to define your tables and queries, and it will create all the Kotlin mappings for you in a transparent fashion. I really like non-invasive libraries that give developers full visibility and control.
Interestingly, this library may soon support other SQL dialects. I’ll probably consider using it in some back end codebases too.