Hi guys, I'm using SQLDelight for my KMM app to ad...
# squarelibraries
r
Hi guys, I'm using SQLDelight for my KMM app to add offline support and I'm stuck at a problem. I'm describing the same briefly below: The response I get from api is
Movie(
val genreIds: List<Int?>?
)
To store the above in database I'm creating a db table like this
Copy code
CREATE TABLE Movie (
   genreIds TEXT AS List<Int>,
);
While instantiating my database I'll need to give a ColumnAdapter to let the SQLDelight know how to store and retrieve
genreIds
to and from database. Here is the ColumnAdapter Implementation
Copy code
val listOfIntsAdapter = object : ColumnAdapter<List<Int>, String> {
    override fun decode(databaseValue: String): List<Int> {
        return if (databaseValue.isEmpty()) {
            emptyList<Int>()
        } else {
            databaseValue.split(",").map { it.toInt() }
        }
    }

    override fun encode(value: List<Int>) = value.joinToString(separator = ",")
}
But As I'm building the project I'm getting this error
Type mismatch: inferred type is ColumnAdapter<kotlin.collections.List<Int>, String> but ColumnAdapter<java.util.List<Int>, String> was expected
The name of my database is
AppDatabase
In the generated
AppDatabaseQueries
class in the imports section, Android Studio is not able to resolve this import. I don't know but this could be the reason for this issue. Thanks in advance