Closed oyvindberg closed 6 months ago
This is built on top of #94 . Enables very convenient usage with things like ZQuery
ZQuery
override def selectByIdsTracked(stateprovinceids: Array[StateprovinceId])(implicit c: Connection): Map[StateprovinceId, Option[StateprovinceRow]] = { val byId = selectByIds(stateprovinceids).view.map(x => (x.stateprovinceid, x)).toMap stateprovinceids.view.map(id => (id, byId.get(id))).toMap } override def selectByIdsTracked(stateprovinceids: Array[StateprovinceId]): ConnectionIO[Map[StateprovinceId, Option[StateprovinceRow]]] = { selectByIds(stateprovinceids).compile.toList.map { rows => val byId = rows.view.map(x => (x.stateprovinceid, x)).toMap stateprovinceids.view.map(id => (id, byId.get(id))).toMap } } override def selectByIdsTracked(stateprovinceids: Array[StateprovinceId]): ZIO[ZConnection, Throwable, Map[StateprovinceId, Option[StateprovinceRow]]] = { selectByIds(stateprovinceids).runCollect.map { rows => val byId = rows.view.map(x => (x.stateprovinceid, x)).toMap stateprovinceids.view.map(id => (id, byId.get(id))).toMap } }
This is built on top of #94 . Enables very convenient usage with things like
ZQuery