
typo.dsl.pagination.internal.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of typo-dsl-doobie_3 Show documentation
Show all versions of typo-dsl-doobie_3 Show documentation
Typed postgres boilerplate generation
package typo.dsl.pagination
object internal {
// avoid cats dependency
implicit class ListOps[T](private val list: List[T]) extends AnyVal {
def traverse[U](f: T => Either[String, U]): Either[String, List[U]] = {
val it = list.iterator
val result = List.newBuilder[U]
while (it.hasNext) {
f(it.next()) match {
case Left(e) => return Left(e)
case Right(u) => result += u
}
}
Right(result.result())
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy