chrisjenx
01/10/2025, 11:53 PMPablichjenkov
01/11/2025, 12:38 AMchrisjenx
01/11/2025, 12:41 AMchrisjenx
01/11/2025, 12:43 AMchrisjenx
01/11/2025, 12:43 AMPablichjenkov
01/11/2025, 12:46 AMPablichjenkov
01/12/2025, 12:39 AMval merchantStore = sqkon.keyValueStore<Merchant>("merchant")
select(where = Merchant::name like "Chi%")
val flow: Flow<List<Merchant>> = merchantStore.select(where = Merchant::name like "Chi%")
But in a typical usage of this storage API you will have several stores. Lets say:
val merchantStore = sqkon.keyValueStore<Merchant>("merchant")
val employeeStore = sqkon.keyValueStore<Employee>("employee")
// Then accidentally
val flow: Flow<List<Merchant>> = merchantStore.select(where = Employee::name like "Chi%")
Q1: Do I get a compiler warning or some static code analysis warning at compilation time? - Indicating the field Employee::name
does not belong to Merchant?
Q2: What will happen at runtime, exception or null is returned?
Then I was thinking of an API that reifies the type.
val flow: Flow<List<Merchant>> = merchantStore.select<Merchant>(where = Employee::name like "Chi%")
Notice the merchantStore.select<Merchant>(...)
. I was thinking that perhaps passing the type could be used internally in select() to make sure the fields match. However, I am thinking now, that this is possible at runtime and would be inefficient.
Definitely this is something that has to be done at compilation time perhaps as a compiler or KSP plugin.chrisjenx
01/12/2025, 12:41 AMchrisjenx
01/12/2025, 12:42 AMchrisjenx
01/12/2025, 12:42 AMchrisjenx
01/12/2025, 12:43 AMchrisjenx
01/12/2025, 12:44 AMPablichjenkov
01/12/2025, 12:45 AMResult.Success/Result.Error
class. That is great!