QueryExecutor

class QueryExecutor(session: CqlSession, schema: TableSchema, statementBuilder: StatementBuilder, codec: KandraCodec = KandraCodec.default, debugConfig: DebugConfig = DebugConfig())

Translates QueryContext predicates into CQL SELECT statements and decodes results.

Lookup predicates trigger a two-step query:

  1. Query the lookup table for the primary table's full key (partition + clustering columns).

  2. Query the primary table by that full key.

@SecondaryIndex predicates query the primary table directly (no two-step needed). A WARN is logged each time a secondary index query executes.

IN on a single-column partition key is supported — a DEBUG message is logged since it causes scatter-gather across partitions (legitimate but worth tracking).

Constructors

Link copied to clipboard
constructor(session: CqlSession, schema: TableSchema, statementBuilder: StatementBuilder, codec: KandraCodec = KandraCodec.default, debugConfig: DebugConfig = DebugConfig())

Functions

Link copied to clipboard
fun exists(block: QueryContext.() -> Unit): Boolean
Link copied to clipboard
suspend fun existsSuspend(block: QueryContext.() -> Unit): Boolean
Link copied to clipboard
fun <T : Any> find(entityClass: KClass<T>, block: QueryContext.() -> Unit): T?
Link copied to clipboard
fun <T : Any> findActive(entityClass: KClass<T>): List<T>
Link copied to clipboard
suspend fun <T : Any> findActiveSuspend(entityClass: KClass<T>): List<T>
Link copied to clipboard
fun <T : Any> findAll(entityClass: KClass<T>, block: QueryContext.() -> Unit): List<T>
Link copied to clipboard
suspend fun <T : Any> findAllSuspend(entityClass: KClass<T>, block: QueryContext.() -> Unit): List<T>
Link copied to clipboard
fun <T : Any> findById(entityClass: KClass<T>, vararg idValues: Any, consistency: KandraConsistency? = null): T?
Link copied to clipboard
suspend fun <T : Any> findByIdSuspend(entityClass: KClass<T>, vararg idValues: Any, consistency: KandraConsistency? = null): T?
Link copied to clipboard
fun <T : Any> findPage(entityClass: KClass<T>, pageSize: Int, pageToken: String?, block: QueryContext.() -> Unit): KandraPage<T>
Link copied to clipboard
suspend fun <T : Any> findPageSuspend(entityClass: KClass<T>, pageSize: Int, pageToken: String?, block: QueryContext.() -> Unit): KandraPage<T>
Link copied to clipboard
suspend fun <T : Any> findSuspend(entityClass: KClass<T>, block: QueryContext.() -> Unit): T?
Link copied to clipboard
fun raw(cql: String, vararg params: Any?): List<Row>
Link copied to clipboard
fun rawQuery(query: KandraRawQuery): List<Row>
Link copied to clipboard
suspend fun rawQuerySuspend(query: KandraRawQuery): List<Row>
Link copied to clipboard
suspend fun rawSuspend(cql: String, vararg params: Any?): List<Row>