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 f0e585b
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package io.getquill

import com.datastax.oss.driver.api.core.cql.AsyncResultSet
import com.datastax.oss.driver.api.core.{CqlSession, CqlSessionBuilder}
import com.typesafe.config.Config
import io.getquill.context.ExecutionInfo
Expand All @@ -9,7 +10,6 @@ import io.getquill.util.{ContextLogger, LoadConfig}

import scala.jdk.CollectionConverters._
import scala.compat.java8.FutureConverters._

import scala.concurrent.{ExecutionContext, Future}

class CassandraAsyncContext[+N <: NamingStrategy](
Expand All @@ -30,7 +30,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 All @@ -54,11 +54,11 @@ class CassandraAsyncContext[+N <: NamingStrategy](
)(info: ExecutionInfo, dc: Runner)(implicit executionContext: ExecutionContext): Result[RunQuerySingleResult[T]] =
executeQuery(cql, prepare, extractor)(info, dc).map(handleSingleResult(cql, _))

def executeAction(cql: String, prepare: Prepare = identityPrepare)(info: ExecutionInfo, dc: Runner)(implicit
def executeAction[T](cql: String, prepare: Prepare = identityPrepare,extractor: Extractor[T] = identityExtractor)(info: ExecutionInfo, dc: Runner)(implicit
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

0 comments on commit f0e585b

Please sign in to comment.