1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/*
* Windmill API
*
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* The version of the OpenAPI document: 1.766.1
* Contact: contact@windmill.dev
* Generated by: https://openapi-generator.tech
*/
use crate::models;
use serde::{Deserialize, Serialize};
/// DataMetric : One `// measure` or `// dimension` declaration, as catalogued from the script that materializes the table. `expr` and `filter` are the author's own SQL: a reader renders a measure as `expr` plus, when `filter` is set, a trailing `FILTER (WHERE filter)`.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct DataMetric {
/// The declaring script, and the path reads are authorized against
#[serde(rename = "script_path")]
pub script_path: String,
/// Canonical scheme-less DuckLake path, `<lake>/<schema>.<table>` (schema defaults to `main`)
#[serde(rename = "table_path")]
pub table_path: String,
#[serde(rename = "kind")]
pub kind: Kind,
#[serde(rename = "name")]
pub name: String,
#[serde(rename = "expr")]
pub expr: String,
/// Row predicate from a measure's trailing `where`
#[serde(rename = "filter", skip_serializing_if = "Option::is_none")]
pub filter: Option<String>,
}
impl DataMetric {
/// One `// measure` or `// dimension` declaration, as catalogued from the script that materializes the table. `expr` and `filter` are the author's own SQL: a reader renders a measure as `expr` plus, when `filter` is set, a trailing `FILTER (WHERE filter)`.
pub fn new(script_path: String, table_path: String, kind: Kind, name: String, expr: String) -> DataMetric {
DataMetric {
script_path,
table_path,
kind,
name,
expr,
filter: None,
}
}
}
///
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Kind {
#[serde(rename = "measure")]
Measure,
#[serde(rename = "dimension")]
Dimension,
}
impl Default for Kind {
fn default() -> Kind {
Self::Measure
}
}