Hey folks! SQLiteNow v0.2 just landed (I've releas...
# feed
t
Hey folks! SQLiteNow v0.2 just landed (I've released it few days ago), and itโ€™s a big one. I am still firmly in the SQL-first camp - you write the SQL for schemas, queries, and views, and the generator keeps everything type-safe on the Kotlin side. I love SQLDelight, but migrated to SQLiteNow, it is more feature-rich for SQLite and designed to shape your data the way you want. Link to the original post if you want a refresher of what SQLiteNow is: https://kotlinlang.slack.com/archives/C0BJ0GTE2/p1750282516245809 Reminder what it is: Kotlin Multiplatform + SQLite; full type-safety, but still writing real SQL; no IDE plugin required; support for inline comment annotations in .sql files so you can shape the generated code exactly how you want it, bring your own data classes for rows projection or let SQLiteNow generate data classes for you. Hereโ€™s whatโ€™s new in v0.2: - Collection mapping - declare mappingType=collection in SQL and pull back entire trees in one shot: no DAOs, no eager/lazy toggles, no N+1 headaches - your query shape is the result shape and - Entity reshaping - mappingType=entity lets you drop existing rows into richer projections, making hexagonal boundaries happier: less glue code between persistence and business layers - Optional OverSqlite module (alpha) โ€“ add two-way sync with PostgreSQL (conflicts, batching, etc.) without giving up SQLite niceties like foreign keys, unique constraints, etc. - Bug fixes, better error diagnostics Link is here: https://github.com/mobiletoly/sqlitenow-kmp (docs are here: https://mobiletoly.github.io/sqlitenow-kmp/) If you are interested in using OverSqlite (two-way sync support for Kotlin Multiplatform) - here is the link to my backend effor: https://github.com/mobiletoly/go-oversync (This is essentially a PostgreSQL two-way sync adapter, I use it for my new project, but it is still in alpha). Spin up a PostgreSQL database, launch a simple golang server and let your mobile client to be able to perform backend backup, sync between multiple devices (or multiple users if you need).
K 3
s
Nice to see you make progress on this! ๐Ÿ™‚ I love SQLDelight, too, but unfortunately it looks like it's not developed a lot further. ๐Ÿ˜• For example for Windows I'm on an old version, because https://github.com/sqldelight/sqldelight/issues/5129 is not fixed already. The bug issues seem to pile up while there are only dependency lib updates by the renovate bot. TL;DR: I'm happy to switch! ๐Ÿ˜ฌ
โž• 1
t
then give it a try ๐Ÿ™‚ so far I was pretty happy to use SQLiteNow in my projects, so would be interesting to get more input
s
I gave your project a star on GitHub, so it's on my list. ๐Ÿ™‚ Not sure when I can switch with my big main project. I guess I'll need to wait until SQLDelight finally breaks and I've no other option than to make the switch. My pet project uses WASM. I saw your discussion with Michael about support for that on the initial post.
m
What about desktop and wasmJs support? I see a jvm target but it does not seem be fully configured to be usable.
โž• 2
โ˜๏ธ 1
s
Wait.. Desktop is not supported? ๐Ÿค” I definitely need that.
If you say "KMP" I assume all targets, but at least Desktop being included. ๐Ÿ˜…
I'm fine if watchOS is not supported. ๐Ÿ˜›
๐Ÿ˜ 1
t
great point, thank you. I have desktop support in local branch, going to merge it. as of wasmJs - unfortunately not, I use androidx.sqlite for KMP and they don't have it available (yet) for wasmJs: https://developer.android.com/kotlin/multiplatform/sqlite
actually my bad, jvm desktop support was already published, it works. but I did update sample-kmp app in repository to reflect it
๐Ÿ‘ 2
I'm actually prototyping JS support, might be not that complicated as I originally thought. a lot of refactoring needed to add SQL.js support, but it is probably for good anyway to get rid of such a hard dependency on bundled androidx.sqlite driver.
๐Ÿ‘€ 1
๐Ÿ‘ 2
the most interesting part would be to ensure that in JS environment I will still be able to support two-way sync with backend PostgreSQL. as a part of SQLiteNow I have it working for iOS, Android, Desktop (right now it is as simple as to add
enableSync=true
annotation to .sql file) with the help of my other project Oversync (https://github.com/mobiletoly/go-oversync), but having in-memory db will make it more fun.
m
I am hoping for a not-only-in-memory database solution ๐Ÿ˜‡.
โž• 1
t
I hope so too ๐Ÿ˜„