pub struct CubeDefinition {Show 17 fields
pub name: String,
pub schema: String,
pub table_pattern: String,
pub chain_column: Option<String>,
pub dimensions: Vec<DimensionNode>,
pub metrics: Vec<MetricDef>,
pub selectors: Vec<SelectorDef>,
pub default_filters: Vec<(String, String)>,
pub default_limit: u32,
pub max_limit: u32,
pub use_final: bool,
pub description: String,
pub joins: Vec<JoinDef>,
pub table_routes: Vec<TableRoute>,
pub custom_query_builder: Option<QueryBuilderFn>,
pub from_subquery: Option<String>,
pub chain_groups: Vec<ChainGroup>,
}Fields§
§name: String§schema: String§table_pattern: StringTable name pattern. Use {chain} as placeholder for chain-prefixed tables
(e.g. {chain}_trades → sol_trades). For tables without chain prefix
(e.g. dex_pool_liquidities), use the literal table name and set
chain_column instead.
chain_column: Option<String>If set, the table doesn’t use a {chain} prefix in its name. Instead,
the chain is filtered via WHERE <chain_column> = ?. Example:
dex_pool_liquidities has a chain column rather than sol_dex_pool_liquidities.
dimensions: Vec<DimensionNode>§metrics: Vec<MetricDef>§selectors: Vec<SelectorDef>§default_filters: Vec<(String, String)>§default_limit: u32§max_limit: u32§use_final: boolAppend FINAL to FROM clause for ReplacingMergeTree tables in ClickHouse.
description: StringHuman-readable description of the cube’s purpose, exposed via _cubeMetadata.
joins: Vec<JoinDef>Declarative JOIN relationships to other cubes.
table_routes: Vec<TableRoute>Alternative tables that can serve subsets of this cube’s columns.
When non-empty, resolve_table picks the best match by requested columns.
custom_query_builder: Option<QueryBuilderFn>Custom query builder that bypasses the standard IR → SQL compilation. Used for cubes requiring window functions, CTEs, or multi-step subqueries.
from_subquery: Option<String>SQL subquery used as the FROM source instead of schema.table.
Supports {schema} and {chain} placeholders expanded at query time.
When set, the compiler generates FROM ({expanded}) AS _t.
chain_groups: Vec<ChainGroup>Which chain wrapper(s) this cube appears under. Empty = legacy flat mode.
Implementations§
Source§impl CubeDefinition
impl CubeDefinition
pub fn table_for_chain(&self, chain: &str) -> String
pub fn qualified_table(&self, chain: &str) -> String
Sourcepub fn resolve_table(
&self,
chain: &str,
requested_columns: &[String],
) -> (String, String)
pub fn resolve_table( &self, chain: &str, requested_columns: &[String], ) -> (String, String)
Pick the optimal (schema, table) for a given chain and set of requested columns. Falls back to the primary schema/table_pattern when no route matches.
pub fn flat_dimensions(&self) -> Vec<(String, Dimension)>
Sourcepub fn has_metric(&self, name: &str) -> bool
pub fn has_metric(&self, name: &str) -> bool
Check if a metric name exists in this cube’s metrics.
Sourcepub fn find_metric(&self, name: &str) -> Option<&MetricDef>
pub fn find_metric(&self, name: &str) -> Option<&MetricDef>
Find a metric definition by name.
Sourcepub fn array_columns(&self) -> Vec<(String, String)>
pub fn array_columns(&self) -> Vec<(String, String)>
Collect all columns used by Array dimensions (parallel arrays).
Returns (graphql_path, column) pairs for every array child field.
Trait Implementations§
Source§impl Clone for CubeDefinition
impl Clone for CubeDefinition
Source§fn clone(&self) -> CubeDefinition
fn clone(&self) -> CubeDefinition
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more