reduxkotlin / redux-kotlin

Redux implementation for Kotlin (supports multiplatform JVM, native, JS, WASM)
https://reduxkotlin.org
MIT License
426 stars 32 forks source link

Working with databases #105

Closed mainrs closed 1 year ago

mainrs commented 2 years ago

Hello!

I am implementing a KMM app and was looking for a way to manage state in a cross-platform way. I am using sqldelight for my data storage needs. The idea was to handle all side-effects of my app with Redux inside the shared module.

I was wondering on how one would work around the fact that modifying data has to be pushed down to the database layer. This applies to data creating, deletion and modification but also to data filtering. Sometimes it is actually faster to re-query the database with specific SQL statements instead of filtering in Kotlin (i.e., 1000 todo items and I want to filter by completed status. select * from todos where completed = 0 is more efficient than doing the filtering in Kotlin for large item counts).

Is there a goto strategy? I haven't found any (example) project that works with a database. be it Sqldelight or Room.

patjackson52 commented 1 year ago

Outside the scope of this core library. A more complete reference sample, which includes a DB, would be great . Will consider that if/when a more complete sample app is made.