aws-sdk-rdsdata 1.100.0

AWS SDK for AWS RDS DataService
Documentation
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT.

/// <p>Contains the value of a column.</p><note>
/// <p>This data structure is only used with the deprecated <code>ExecuteSql</code> operation. Use the <code>BatchExecuteStatement</code> or <code>ExecuteStatement</code> operation instead.</p>
/// </note>
#[non_exhaustive]
#[derive(::std::clone::Clone, ::std::cmp::PartialEq, ::std::fmt::Debug)]
pub enum Value {
    /// <p>An array of column values.</p>
    ArrayValues(::std::vec::Vec<crate::types::Value>),
    /// <p>A value for a column of big integer data type.</p>
    BigIntValue(i64),
    /// <p>A value for a column of BIT data type.</p>
    BitValue(bool),
    /// <p>A value for a column of BLOB data type.</p>
    BlobValue(::aws_smithy_types::Blob),
    /// <p>A value for a column of double data type.</p>
    DoubleValue(f64),
    /// <p>A value for a column of integer data type.</p>
    IntValue(i32),
    /// <p>A NULL value.</p>
    IsNull(bool),
    /// <p>A value for a column of real data type.</p>
    RealValue(f32),
    /// <p>A value for a column of string data type.</p>
    StringValue(::std::string::String),
    /// <p>A value for a column of STRUCT data type.</p>
    StructValue(crate::types::StructValue),
    /// The `Unknown` variant represents cases where new union variant was received. Consider upgrading the SDK to the latest available version.
    /// An unknown enum variant
    ///
    /// _Note: If you encounter this error, consider upgrading your SDK to the latest version._
    /// The `Unknown` variant represents cases where the server sent a value that wasn't recognized
    /// by the client. This can happen when the server adds new functionality, but the client has not been updated.
    /// To investigate this, consider turning on debug logging to print the raw HTTP response.
    #[non_exhaustive]
    Unknown,
}
impl Value {
    /// Tries to convert the enum instance into [`ArrayValues`](crate::types::Value::ArrayValues), extracting the inner [`Vec`](::std::vec::Vec).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_array_values(&self) -> ::std::result::Result<&::std::vec::Vec<crate::types::Value>, &Self> {
        if let Value::ArrayValues(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`ArrayValues`](crate::types::Value::ArrayValues).
    pub fn is_array_values(&self) -> bool {
        self.as_array_values().is_ok()
    }
    /// Tries to convert the enum instance into [`BigIntValue`](crate::types::Value::BigIntValue), extracting the inner [`i64`](i64).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_big_int_value(&self) -> ::std::result::Result<&i64, &Self> {
        if let Value::BigIntValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`BigIntValue`](crate::types::Value::BigIntValue).
    pub fn is_big_int_value(&self) -> bool {
        self.as_big_int_value().is_ok()
    }
    /// Tries to convert the enum instance into [`BitValue`](crate::types::Value::BitValue), extracting the inner [`bool`](bool).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_bit_value(&self) -> ::std::result::Result<&bool, &Self> {
        if let Value::BitValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`BitValue`](crate::types::Value::BitValue).
    pub fn is_bit_value(&self) -> bool {
        self.as_bit_value().is_ok()
    }
    /// Tries to convert the enum instance into [`BlobValue`](crate::types::Value::BlobValue), extracting the inner [`Blob`](::aws_smithy_types::Blob).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_blob_value(&self) -> ::std::result::Result<&::aws_smithy_types::Blob, &Self> {
        if let Value::BlobValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`BlobValue`](crate::types::Value::BlobValue).
    pub fn is_blob_value(&self) -> bool {
        self.as_blob_value().is_ok()
    }
    /// Tries to convert the enum instance into [`DoubleValue`](crate::types::Value::DoubleValue), extracting the inner [`f64`](f64).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_double_value(&self) -> ::std::result::Result<&f64, &Self> {
        if let Value::DoubleValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`DoubleValue`](crate::types::Value::DoubleValue).
    pub fn is_double_value(&self) -> bool {
        self.as_double_value().is_ok()
    }
    /// Tries to convert the enum instance into [`IntValue`](crate::types::Value::IntValue), extracting the inner [`i32`](i32).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_int_value(&self) -> ::std::result::Result<&i32, &Self> {
        if let Value::IntValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`IntValue`](crate::types::Value::IntValue).
    pub fn is_int_value(&self) -> bool {
        self.as_int_value().is_ok()
    }
    /// Tries to convert the enum instance into [`IsNull`](crate::types::Value::IsNull), extracting the inner [`bool`](bool).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_is_null(&self) -> ::std::result::Result<&bool, &Self> {
        if let Value::IsNull(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`IsNull`](crate::types::Value::IsNull).
    pub fn is_is_null(&self) -> bool {
        self.as_is_null().is_ok()
    }
    /// Tries to convert the enum instance into [`RealValue`](crate::types::Value::RealValue), extracting the inner [`f32`](f32).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_real_value(&self) -> ::std::result::Result<&f32, &Self> {
        if let Value::RealValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`RealValue`](crate::types::Value::RealValue).
    pub fn is_real_value(&self) -> bool {
        self.as_real_value().is_ok()
    }
    /// Tries to convert the enum instance into [`StringValue`](crate::types::Value::StringValue), extracting the inner [`String`](::std::string::String).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_string_value(&self) -> ::std::result::Result<&::std::string::String, &Self> {
        if let Value::StringValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`StringValue`](crate::types::Value::StringValue).
    pub fn is_string_value(&self) -> bool {
        self.as_string_value().is_ok()
    }
    /// Tries to convert the enum instance into [`StructValue`](crate::types::Value::StructValue), extracting the inner [`StructValue`](crate::types::StructValue).
    /// Returns `Err(&Self)` if it can't be converted.
    pub fn as_struct_value(&self) -> ::std::result::Result<&crate::types::StructValue, &Self> {
        if let Value::StructValue(val) = &self {
            ::std::result::Result::Ok(val)
        } else {
            ::std::result::Result::Err(self)
        }
    }
    /// Returns true if this is a [`StructValue`](crate::types::Value::StructValue).
    pub fn is_struct_value(&self) -> bool {
        self.as_struct_value().is_ok()
    }
    /// Returns true if the enum instance is the `Unknown` variant.
    pub fn is_unknown(&self) -> bool {
        matches!(self, Self::Unknown)
    }
}