windmill-api 1.765.0

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
Documentation
/*
 * Windmill API
 *
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.765.0
 * 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
    }
}