pub struct MetricDefinition {
pub name: String,
pub description: Option<String>,
pub label: Option<String>,
pub type_params: Option<Value>,
pub base_metric: Option<Value>,
pub conversion_metric: Option<Value>,
pub input_metric: Option<Value>,
}Expand description
A metric definition (dbt Semantic Layer)
Fields§
§name: String§description: Option<String>§label: Option<String>§type_params: Option<Value>Raw type_params blob — used to extract measure/metric references without needing to model the full metric type hierarchy.
base_metric: Option<Value>Conversion metric: the base metric to track (top-level field, not inside type_params).
conversion_metric: Option<Value>Conversion metric: the conversion event metric (top-level field, not inside type_params).
input_metric: Option<Value>Cumulative metric: the input metric to accumulate (top-level field, not inside type_params).
Implementations§
Source§impl MetricDefinition
impl MetricDefinition
Sourcepub fn measure_refs(&self) -> Vec<&str>
pub fn measure_refs(&self) -> Vec<&str>
Extract all measure names this metric references.
Covers all metric types that reference measures directly:
- Simple:
type_params.measure - Conversion:
type_params.base_measure,type_params.conversion_measure
Sourcepub fn metric_refs(&self) -> Vec<&str>
pub fn metric_refs(&self) -> Vec<&str>
Extract metric names this metric depends on (Ratio/Derived/Conversion/Cumulative).
Trait Implementations§
Source§impl Clone for MetricDefinition
impl Clone for MetricDefinition
Source§fn clone(&self) -> MetricDefinition
fn clone(&self) -> MetricDefinition
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MetricDefinition
impl Debug for MetricDefinition
Source§impl<'de> Deserialize<'de> for MetricDefinition
impl<'de> Deserialize<'de> for MetricDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for MetricDefinition
impl RefUnwindSafe for MetricDefinition
impl Send for MetricDefinition
impl Sync for MetricDefinition
impl Unpin for MetricDefinition
impl UnsafeUnpin for MetricDefinition
impl UnwindSafe for MetricDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more