Saharath Kleips
02/12/2021, 7:25 PMclass Shape(val primaryIds: List<String>, val secondaryIds: List<String>, val tertiaryIds: List<String>) { // ids fetched from first DB call
lateinit var primaryColors: List<Color> // colors fetched from subsequent DB call
lateinit var secondaryColors: List<Color> // could be `fun` instead
lateinit var tertiaryColors: List<Color>
}
and a ColorService
bean that does the data fetching:
fun getColors(ids: List<String>): List<Colors> { ... }
What would be the pattern here? Do we pass in an instance of ColorService
during the construction of `Shape`s so now that batching is a service level concern? How would the service batch the three calls coming from primary, secondary, and tertiary?