Initializes a new instance of the CassandraTable class with specified configuration. This includes setting up the table schema (primary key, columns, and indices) and preparing the environment for executing queries against a Cassandra database.
Configuration arguments defining the table schema and operational settings.
Optional
client: ClientOptional. A Cassandra Client instance. If not provided, one will be created
using the configuration specified in args
.
Deletes rows from the Cassandra table that match the specified WHERE clause conditions.
Defines the conditions that must be met for rows to be deleted. Can be a single filter, an array of filters, or a key-value map translating to filter conditions.
A Promise that resolves when the DELETE operation has completed.
Retrieves the Node.js Cassandra client instance associated with this table. This method ensures that the client is initialized and ready for use, returning the Cassandra client object that can be used for database operations directly. It initializes the client if it has not already been initialized.
A Promise that resolves to the Cassandra Client instance used by this table for database interactions.
Executes a SELECT query on the Cassandra table with optional filtering, ordering, and pagination. Allows for specifying columns to return, filter conditions, sort order, and limits on the number of results.
Optional
columns: Column[]Optional. Columns to include in the result set. If omitted, all columns are selected.
Optional
filter: WhereClauseOptional. Conditions to apply to the query for filtering results.
Optional
orderBy: Filter[]Optional. Criteria to sort the result set.
Optional
limit: numberOptional. Maximum number of records to return.
Optional
allowFiltering: booleanOptional. Enables ALLOW FILTERING option for queries that cannot be executed directly due to Cassandra's query restrictions.
Optional
fetchSize: numberOptional. The number of rows to fetch per page (for pagination).
Optional
pagingState: stringOptional. The paging state from a previous query execution, used for pagination.
A Promise resolving to the query result set.
Inserts or updates records in the Cassandra table in batches, managing concurrency and batching size.
This method organizes the provided values into batches and uses _upsert
to perform the database operations.
An array of arrays, where each inner array contains values for a single record.
Optional
columns: Column[]Optional. Columns to be included in the insert/update operations. Defaults to all table columns.
Optional. The size of each batch for the operation. Defaults to the class's batchSize property.
A Promise that resolves once all records have been upserted.
Generated using TypeDoc
Represents a Cassandra table, encapsulating functionality for schema definition, data manipulation, and querying. This class provides a high-level abstraction over Cassandra's table operations, including creating tables, inserting, updating, selecting, and deleting records. It leverages the CassandraClient for executing operations and supports asynchronous interactions with the database.
Key features include:
The class is designed to be instantiated with a set of configuration arguments (
CassandraTableArgs
) that define the table's structure and operational parameters, providing a streamlined interface for interacting with Cassandra tables in a structured and efficient manner.Usage Example:
This class simplifies Cassandra database interactions, making it easier to perform robust data operations while maintaining clear separation of concerns and promoting code reusability.