Skip to content

Commit

Permalink
Update quill-cassandra-ce/src/main/scala-2.12/io/getquill/CassandraCe…
Browse files Browse the repository at this point in the history
…Context.scala


executeQuery optimization

Co-authored-by: Diego E. Alonso Blas <diesalbla@gmail.com>
  • Loading branch information
voropaevp and diesalbla authored Jul 31, 2021
1 parent fa1b277 commit 3d897d9
Showing 1 changed file with 2 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,8 @@ class CassandraCeContext[N <: NamingStrategy, F[_]](
.map(extractor)
}

def executeQuery[T](cql: String, prepare: Prepare = identityPrepare, extractor: Extractor[T] = identityExtractor): Result[RunQueryResult[T]] = {
streamQuery[T](cql, prepare, extractor)
.fold(List[T]())({ case (l, r) => r +: l })
.map(_.reverse)
.covary[F]
.compile
.toList.map(_.head)
}
def executeQuery[T](cql: String, prepare: Prepare = identityPrepare, extractor: Extractor[T] = identityExtractor): Result[RunQueryResult[T]] =
streamQuery[T](cql, prepare, extractor).compile.toList

def executeQuerySingle[T](cql: String, prepare: Prepare = identityPrepare, extractor: Extractor[T] = identityExtractor): Result[RunQuerySingleResult[T]] =
Functor[F].map(executeQuery(cql, prepare, extractor))(handleSingleResult)
Expand Down

0 comments on commit 3d897d9

Please sign in to comment.