Skip to main content

CubeDefinition

Struct CubeDefinition 

Source
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: String

Table name pattern. Use {chain} as placeholder for chain-prefixed tables (e.g. {chain}_tradessol_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: bool

Append FINAL to FROM clause for ReplacingMergeTree tables in ClickHouse.

§description: String

Human-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

Source

pub fn table_for_chain(&self, chain: &str) -> String

Source

pub fn qualified_table(&self, chain: &str) -> String

Source

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.

Source

pub fn flat_dimensions(&self) -> Vec<(String, Dimension)>

Source

pub fn has_metric(&self, name: &str) -> bool

Check if a metric name exists in this cube’s metrics.

Source

pub fn find_metric(&self, name: &str) -> Option<&MetricDef>

Find a metric definition by name.

Source

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

Source§

fn clone(&self) -> CubeDefinition

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for CubeDefinition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more