diff --git a/quill-cassandra/src/main/scala/io/getquill/CassandraAsyncContext.scala b/quill-cassandra/src/main/scala/io/getquill/CassandraAsyncContext.scala index 996ef13ae7..8ad5793282 100644 --- a/quill-cassandra/src/main/scala/io/getquill/CassandraAsyncContext.scala +++ b/quill-cassandra/src/main/scala/io/getquill/CassandraAsyncContext.scala @@ -1,16 +1,15 @@ package io.getquill -import com.datastax.oss.driver.api.core.{CqlSession, CqlSessionBuilder} +import com.datastax.oss.driver.api.core.CqlSession +import com.datastax.oss.driver.api.core.cql.AsyncResultSet import com.typesafe.config.Config import io.getquill.context.ExecutionInfo -import io.getquill.context.cassandra.util.FutureConversions._ import io.getquill.monad.ScalaFutureIOMonad import io.getquill.util.{ContextLogger, LoadConfig} -import scala.jdk.CollectionConverters._ import scala.compat.java8.FutureConverters._ - import scala.concurrent.{ExecutionContext, Future} +import scala.jdk.CollectionConverters._ class CassandraAsyncContext[+N <: NamingStrategy]( naming: N, @@ -30,7 +29,7 @@ class CassandraAsyncContext[+N <: NamingStrategy]( override type Result[T] = Future[T] override type RunQueryResult[T] = List[T] override type RunQuerySingleResult[T] = T - override type RunActionResult = Unit + override type RunActionResult = AsyncResultSet override type RunBatchActionResult = Unit override type Runner = Unit @@ -58,7 +57,7 @@ class CassandraAsyncContext[+N <: NamingStrategy]( executionContext: ExecutionContext ): Result[RunActionResult] = { val statement = prepareAsyncAndGetStatement(cql, prepare, this, logger) - statement.flatMap(st => session.executeAsync(st).toCompletableFuture.toScala).map(_ => ()) + statement.flatMap(st => session.executeAsync(st).toCompletableFuture.toScala) } def executeBatchAction( diff --git a/quill-cassandra/src/test/scala/io/getquill/context/cassandra/CassandraContextSpec.scala b/quill-cassandra/src/test/scala/io/getquill/context/cassandra/CassandraContextSpec.scala index 8db98d048b..53f9ec4612 100644 --- a/quill-cassandra/src/test/scala/io/getquill/context/cassandra/CassandraContextSpec.scala +++ b/quill-cassandra/src/test/scala/io/getquill/context/cassandra/CassandraContextSpec.scala @@ -1,6 +1,7 @@ package io.getquill.context.cassandra -import io.getquill._ +import com.datastax.oss.driver.api.core.cql.AsyncResultSet +import io.getquill.{EntityQuery, Quoted, Update} import io.getquill.base.Spec import io.getquill.context.ExecutionInfo @@ -14,10 +15,12 @@ class CassandraContextSpec extends Spec { "async" in { import testAsyncDB._ case class TestEntity(id: Int, s: String, i: Int, l: Long, o: Int) - val update = quote { + val update: Quoted[Update[TestEntity]] = quote { query[TestEntity].filter(_.id == lift(1)).update(_.i -> lift(1)) } - await(testAsyncDB.run(update)) mustEqual (()) + val result: AsyncResultSet = await(testAsyncDB.run(update)) + assert(result != null) + } "sync" in { import testSyncDB._