aws-sdk-timestreamquery 1.105.0

AWS SDK for Amazon Timestream Query
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Datum represents a single data point in a query result.</p>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub struct Datum {
    /// <p>Indicates if the data point is a scalar value such as integer, string, double, or Boolean.</p>
    pub scalar_value: ::std::option::Option<::std::string::String>,
    /// <p>Indicates if the data point is a timeseries data type.</p>
    pub time_series_value: ::std::option::Option<::std::vec::Vec<crate::types::TimeSeriesDataPoint>>,
    /// <p>Indicates if the data point is an array.</p>
    pub array_value: ::std::option::Option<::std::vec::Vec<crate::types::Datum>>,
    /// <p>Indicates if the data point is a row.</p>
    pub row_value: ::std::option::Option<crate::types::Row>,
    /// <p>Indicates if the data point is null.</p>
    pub null_value: ::std::option::Option<bool>,
}
impl Datum {
    /// <p>Indicates if the data point is a scalar value such as integer, string, double, or Boolean.</p>
    pub fn scalar_value(&self) -> ::std::option::Option<&str> {
        self.scalar_value.as_deref()
    }
    /// <p>Indicates if the data point is a timeseries data type.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.time_series_value.is_none()`.
    pub fn time_series_value(&self) -> &[crate::types::TimeSeriesDataPoint] {
        self.time_series_value.as_deref().unwrap_or_default()
    }
    /// <p>Indicates if the data point is an array.</p>
    ///
    /// If no value was sent for this field, a default will be set. If you want to determine if no value was sent, use `.array_value.is_none()`.
    pub fn array_value(&self) -> &[crate::types::Datum] {
        self.array_value.as_deref().unwrap_or_default()
    }
    /// <p>Indicates if the data point is a row.</p>
    pub fn row_value(&self) -> ::std::option::Option<&crate::types::Row> {
        self.row_value.as_ref()
    }
    /// <p>Indicates if the data point is null.</p>
    pub fn null_value(&self) -> ::std::option::Option<bool> {
        self.null_value
    }
}
impl Datum {
    /// Creates a new builder-style object to manufacture [`Datum`](crate::types::Datum).
    pub fn builder() -> crate::types::builders::DatumBuilder {
        crate::types::builders::DatumBuilder::default()
    }
}

/// A builder for [`Datum`](crate::types::Datum).
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::default::Default, ::std::fmt::Debug)]
#[non_exhaustive]
pub struct DatumBuilder {
    pub(crate) scalar_value: ::std::option::Option<::std::string::String>,
    pub(crate) time_series_value: ::std::option::Option<::std::vec::Vec<crate::types::TimeSeriesDataPoint>>,
    pub(crate) array_value: ::std::option::Option<::std::vec::Vec<crate::types::Datum>>,
    pub(crate) row_value: ::std::option::Option<crate::types::Row>,
    pub(crate) null_value: ::std::option::Option<bool>,
}
impl DatumBuilder {
    /// <p>Indicates if the data point is a scalar value such as integer, string, double, or Boolean.</p>
    pub fn scalar_value(mut self, input: impl ::std::convert::Into<::std::string::String>) -> Self {
        self.scalar_value = ::std::option::Option::Some(input.into());
        self
    }
    /// <p>Indicates if the data point is a scalar value such as integer, string, double, or Boolean.</p>
    pub fn set_scalar_value(mut self, input: ::std::option::Option<::std::string::String>) -> Self {
        self.scalar_value = input;
        self
    }
    /// <p>Indicates if the data point is a scalar value such as integer, string, double, or Boolean.</p>
    pub fn get_scalar_value(&self) -> &::std::option::Option<::std::string::String> {
        &self.scalar_value
    }
    /// Appends an item to `time_series_value`.
    ///
    /// To override the contents of this collection use [`set_time_series_value`](Self::set_time_series_value).
    ///
    /// <p>Indicates if the data point is a timeseries data type.</p>
    pub fn time_series_value(mut self, input: crate::types::TimeSeriesDataPoint) -> Self {
        let mut v = self.time_series_value.unwrap_or_default();
        v.push(input);
        self.time_series_value = ::std::option::Option::Some(v);
        self
    }
    /// <p>Indicates if the data point is a timeseries data type.</p>
    pub fn set_time_series_value(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::TimeSeriesDataPoint>>) -> Self {
        self.time_series_value = input;
        self
    }
    /// <p>Indicates if the data point is a timeseries data type.</p>
    pub fn get_time_series_value(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::TimeSeriesDataPoint>> {
        &self.time_series_value
    }
    /// Appends an item to `array_value`.
    ///
    /// To override the contents of this collection use [`set_array_value`](Self::set_array_value).
    ///
    /// <p>Indicates if the data point is an array.</p>
    pub fn array_value(mut self, input: crate::types::Datum) -> Self {
        let mut v = self.array_value.unwrap_or_default();
        v.push(input);
        self.array_value = ::std::option::Option::Some(v);
        self
    }
    /// <p>Indicates if the data point is an array.</p>
    pub fn set_array_value(mut self, input: ::std::option::Option<::std::vec::Vec<crate::types::Datum>>) -> Self {
        self.array_value = input;
        self
    }
    /// <p>Indicates if the data point is an array.</p>
    pub fn get_array_value(&self) -> &::std::option::Option<::std::vec::Vec<crate::types::Datum>> {
        &self.array_value
    }
    /// <p>Indicates if the data point is a row.</p>
    pub fn row_value(mut self, input: crate::types::Row) -> Self {
        self.row_value = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates if the data point is a row.</p>
    pub fn set_row_value(mut self, input: ::std::option::Option<crate::types::Row>) -> Self {
        self.row_value = input;
        self
    }
    /// <p>Indicates if the data point is a row.</p>
    pub fn get_row_value(&self) -> &::std::option::Option<crate::types::Row> {
        &self.row_value
    }
    /// <p>Indicates if the data point is null.</p>
    pub fn null_value(mut self, input: bool) -> Self {
        self.null_value = ::std::option::Option::Some(input);
        self
    }
    /// <p>Indicates if the data point is null.</p>
    pub fn set_null_value(mut self, input: ::std::option::Option<bool>) -> Self {
        self.null_value = input;
        self
    }
    /// <p>Indicates if the data point is null.</p>
    pub fn get_null_value(&self) -> &::std::option::Option<bool> {
        &self.null_value
    }
    /// Consumes the builder and constructs a [`Datum`](crate::types::Datum).
    pub fn build(self) -> crate::types::Datum {
        crate::types::Datum {
            scalar_value: self.scalar_value,
            time_series_value: self.time_series_value,
            array_value: self.array_value,
            row_value: self.row_value,
            null_value: self.null_value,
        }
    }
}