AshScylla.Query (AshScylla v1.5.2)

Copy Markdown View Source

Represents a pending ScyllaDB query being built from Ash query expressions.

Passed through the query pipeline and converted to CQL at execution time. This module is the single owner of the query struct — DataLayer and QueryBuilder operate on %AshScylla.Query{} but do not define their own.

Summary

Types

t()

The pending ScyllaDB query struct.

Functions

Create a new query from just a resource (repo resolved from DSL).

Create a new query from a resource and repo.

Types

t()

@type t() :: %AshScylla.Query{
  aggregates: [map()],
  atomic: atom() | nil,
  context: map(),
  distinct: [atom()] | nil,
  filters: list(),
  group_by: [atom()] | nil,
  keyset: term(),
  limit: pos_integer() | nil,
  repo: module() | nil,
  resource: Ash.Resource.t(),
  select: [atom()] | nil,
  sorts: list(),
  table: String.t() | nil,
  tenant: term(),
  upsert?: boolean(),
  upsert_fields: [atom()],
  upsert_identity: atom() | nil
}

The pending ScyllaDB query struct.

Built from Ash query expressions and converted to CQL at execution time.

Fields

  • :resource — the Ash resource module
  • :repo — the AshScylla repo module used to run queries
  • :table — the ScyllaDB table name
  • :filters — list of filter expressions for the WHERE clause
  • :sorts — list of sort expressions for the ORDER BY clause
  • :limit — optional LIMIT value
  • :select — optional list of columns to SELECT
  • :distinct — optional list of columns for SELECT DISTINCT
  • :tenant — multitenancy tenant identifier
  • :context — arbitrary context map passed through the query pipeline
  • :atomic — optional atomic operation type (e.g. {:atomic, :upsert})
  • :upsert? — whether this query uses upsert semantics
  • :upsert_fields — fields to upsert on conflict
  • :upsert_identity — identity to use for upsert conflict resolution
  • :keyset — keyset pagination cursor
  • :aggregates — list of aggregate specifications
  • :group_by — optional list of columns for GROUP BY

Functions

new(resource)

@spec new(module()) :: t()

Create a new query from just a resource (repo resolved from DSL).

new(resource, repo)

@spec new(module(), module()) :: t()

Create a new query from a resource and repo.

Reads table, keyspace, consistency, and TTL from the resource's DSL config.