-
Notifications
You must be signed in to change notification settings - Fork 18
Add SQLDelight driver #231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9b34eff
to
f532ba9
Compare
I just tried SQLDelight and I really liked how much safety it does bring to the creation of queries and mapping the results. Would be happy to use it on PowerSync views. |
1c518d7
to
802d6c4
Compare
802d6c4
to
101aa55
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments. This looks amazing! Happy with the implementation.
...ns/sqldelight/src/commonMain/kotlin/com/powersync/integrations/sqldelight/PowerSyncDriver.kt
Show resolved
Hide resolved
...ns/sqldelight/src/commonMain/kotlin/com/powersync/integrations/sqldelight/PowerSyncDriver.kt
Outdated
Show resolved
Hide resolved
101aa55
to
d2bdb2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀
The base branch was changed.
d2bdb2b
to
e9f28ab
Compare
Simon, I see you suggest |
Yes, I think that should work. It's also worth mentioning that |
This adds a new project in the
integrations
folder that provides a single class:PowerSyncDriver
. That class implements theSqlDriver
interface fromSQLDelight
by forwarding queries and statements to an opened PowerSync database.Additionally, query listeners in that driver are backed by
PowerSyncDatabase.onChange
, meaning that all changes between the original powersync database and the SQLDelight wrapper are visible to each other and cause reactive updates. An obvious but still pretty cool result is that updates from the sync client also trigger updates to flows in SQLDelight.I've added a test project to run unit tests against a SQLDelight database, but no real example yet.