prorm API Reference
    Preparing search index...

    Class CassandraStore

    CassandraStore wraps a cassandra-driver Client and exposes CQL execution (execute), atomic multi-statement batches (batch), and a few parameterized convenience helpers (insert, selectAll).

    Statements are prepared by default (prepare: true) so the driver can cache query metadata, infer parameter types, and route requests to replica nodes that own the partition — the recommended default for anything run more than once.

    Implements

    Index
    name: "cassandra" = 'cassandra'

    The name of the store (e.g. 'mongodb', 'redis', 'dynamodb')

    library: "cassandra-driver" = 'cassandra-driver'

    The client library being used

    • Execute a single CQL statement with optional bound params. Statements are prepared by default (prepare: true); pass opts.prepare = false to run a one-off unprepared. Any other driver query options (consistency, fetchSize, pageState, ...) are forwarded via opts. Returns the full driver result (with .rows).

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • query: string
      • params: unknown[] = []
      • opts: CassandraQueryOptions = {}

      Returns Promise<CassandraResult<T>>

    • Execute multiple statements as a single logged batch (atomic across the statements, though not isolated — Cassandra batches are not SQL transactions). Each entry is a { query, params } pair. Prepared by default; forward other driver batch options via opts.

      Parameters

      • queries: CassandraBatchQuery[]
      • opts: CassandraQueryOptions = {}

      Returns Promise<CassandraResult<Record<string, unknown>>>

    • Convenience INSERT: builds a parameterized INSERT INTO table (cols...) VALUES (?, ?, ...) from obj's keys and executes it (prepared). For upserts with TTL, IF NOT EXISTS, or other clauses, write the CQL yourself and call execute().

      Parameters

      • table: string
      • obj: Record<string, unknown>
      • opts: CassandraQueryOptions = {}

      Returns Promise<CassandraResult<Record<string, unknown>>>

    • Convenience SELECT * FROM table. Returns the full driver result (with .rows).

      Type Parameters

      • T = Record<string, unknown>

      Parameters

      • table: string
      • opts: CassandraQueryOptions = {}

      Returns Promise<CassandraResult<T>>