Skip to main content

nominal_api_conjure/conjure/objects/scout/compute/api/
series_variable.rs

1/// A series selected from a dataset, bound to a variable. The series type (numeric, enum, ...) is decided
2/// lazily by the node consuming the variable, matching the behaviour of channel variables.
3#[derive(
4    Debug,
5    Clone,
6    conjure_object::serde::Serialize,
7    conjure_object::serde::Deserialize,
8    conjure_object::private::DeriveWith
9)]
10#[serde(crate = "conjure_object::serde")]
11#[derive_with(PartialEq, Eq, PartialOrd, Ord, Hash)]
12#[conjure_object::private::staged_builder::staged_builder]
13#[builder(crate = conjure_object::private::staged_builder, update, inline)]
14pub struct SeriesVariable {
15    #[builder(custom(type = super::SelectSeries, convert = Box::new))]
16    #[serde(rename = "select")]
17    select: Box<super::SelectSeries>,
18    #[builder(default, set(item(type = super::StringConstant)))]
19    #[serde(
20        rename = "groupByTags",
21        skip_serializing_if = "std::collections::BTreeSet::is_empty",
22        default
23    )]
24    group_by_tags: std::collections::BTreeSet<super::StringConstant>,
25}
26impl SeriesVariable {
27    /// Constructs a new instance of the type.
28    #[inline]
29    pub fn new(select: super::SelectSeries) -> Self {
30        Self::builder().select(select).build()
31    }
32    #[inline]
33    pub fn select(&self) -> &super::SelectSeries {
34        &*self.select
35    }
36    /// Tags that the series should be grouped by. If this is non-empty a grouped result will be returned
37    /// with an entry for each grouping; otherwise all matching series are merged.
38    #[inline]
39    pub fn group_by_tags(&self) -> &std::collections::BTreeSet<super::StringConstant> {
40        &self.group_by_tags
41    }
42}