SqlDelight question: Possible to remove any of thi...
# squarelibraries
d
SqlDelight question: Possible to remove any of this boilerplate code? I have a database table called “Countries”, for which SqlDelight generated a data class “Countries”. I then have a serializable Repository data class “CountryData”, used by Ktor to serialize the Api response. These two data classes have basically the same properties, and at the moment I need to write this code to match the two objects, which seems to be a lot of boilerplate code: I have to write the same property 3 times. Is it possible to simplify in any way?
Copy code
fun LocalDb.getCountriesList() : List<CountryData> {
    return countriesQueries.getCountriesList(
        mapper = { name, population, first_doses, fully_vaccinated ->
            CountryData(name = name, population = population, firstDoses = first_doses, fullyVaccinated = fully_vaccinated)
        }).executeAsList()
}