Skip to content

Commit

Permalink
add return type for executeAction
Browse files Browse the repository at this point in the history
  • Loading branch information
kemal durmuş committed Oct 2, 2023
1 parent 745ac80 commit 00086ca
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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

Expand Down Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package io.getquill.context.cassandra

import io.getquill._
import com.datastax.oss.driver.api.core.cql.AsyncResultSet
import io.getquill.base.Spec
import io.getquill.context.ExecutionInfo

Expand All @@ -17,7 +17,7 @@ class CassandraContextSpec extends Spec {
val update = quote {
query[TestEntity].filter(_.id == lift(1)).update(_.i -> lift(1))
}
await(testAsyncDB.run(update)) mustEqual (())
await(testAsyncDB.run(update)) mustEqual (AsyncResultSet)
}
"sync" in {
import testSyncDB._
Expand Down

0 comments on commit 00086ca

Please sign in to comment.