#[non_exhaustive]pub struct DataQualityRule {
pub column: String,
pub ignore_null: bool,
pub dimension: String,
pub threshold: f64,
pub name: String,
pub description: String,
pub suspended: bool,
pub rule_type: Option<RuleType>,
/* private fields */
}Expand description
A rule captures data quality intent about a data source.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.column: StringOptional. The unnested column which this rule is evaluated against.
ignore_null: boolOptional. Rows with null values will automatically fail a rule, unless
ignore_null is true. In that case, such null rows are trivially
considered passing.
This field is only valid for the following type of rules:
- RangeExpectation
- RegexExpectation
- SetExpectation
- UniquenessExpectation
dimension: StringRequired. The dimension a rule belongs to. Results are also aggregated at the dimension level. Custom dimension name is supported with all uppercase letters and maximum length of 30 characters.
threshold: f64Optional. The minimum ratio of passing_rows / total_rows required to pass this rule, with a range of [0.0, 1.0].
0 indicates default value (i.e. 1.0).
This field is only valid for row-level type rules.
name: StringOptional. A mutable name for the rule.
- The name must contain only letters (a-z, A-Z), numbers (0-9), or hyphens (-).
- The maximum length is 63 characters.
- Must start with a letter.
- Must end with a number or a letter.
description: StringOptional. Description of the rule.
- The maximum length is 1,024 characters.
suspended: boolOptional. Whether the Rule is active or suspended. Default is false.
rule_type: Option<RuleType>The rule-specific configuration.
Implementations§
Source§impl DataQualityRule
impl DataQualityRule
pub fn new() -> Self
Sourcepub fn set_column<T: Into<String>>(self, v: T) -> Self
pub fn set_column<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_ignore_null<T: Into<bool>>(self, v: T) -> Self
pub fn set_ignore_null<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn set_dimension<T: Into<String>>(self, v: T) -> Self
pub fn set_dimension<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_threshold<T: Into<f64>>(self, v: T) -> Self
pub fn set_threshold<T: Into<f64>>(self, v: T) -> Self
Sourcepub fn set_description<T: Into<String>>(self, v: T) -> Self
pub fn set_description<T: Into<String>>(self, v: T) -> Self
Sourcepub fn set_suspended<T: Into<bool>>(self, v: T) -> Self
pub fn set_suspended<T: Into<bool>>(self, v: T) -> Self
Sourcepub fn set_rule_type<T: Into<Option<RuleType>>>(self, v: T) -> Self
pub fn set_rule_type<T: Into<Option<RuleType>>>(self, v: T) -> Self
Sets the value of rule_type.
Note that all the setters affecting rule_type are mutually
exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RangeExpectation;
let x = DataQualityRule::new().set_rule_type(Some(
google_cloud_dataplex_v1::model::data_quality_rule::RuleType::RangeExpectation(RangeExpectation::default().into())));Sourcepub fn range_expectation(&self) -> Option<&Box<RangeExpectation>>
pub fn range_expectation(&self) -> Option<&Box<RangeExpectation>>
The value of rule_type
if it holds a RangeExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_range_expectation<T: Into<Box<RangeExpectation>>>(self, v: T) -> Self
pub fn set_range_expectation<T: Into<Box<RangeExpectation>>>(self, v: T) -> Self
Sets the value of rule_type
to hold a RangeExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RangeExpectation;
let x = DataQualityRule::new().set_range_expectation(RangeExpectation::default()/* use setters */);
assert!(x.range_expectation().is_some());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn non_null_expectation(&self) -> Option<&Box<NonNullExpectation>>
pub fn non_null_expectation(&self) -> Option<&Box<NonNullExpectation>>
The value of rule_type
if it holds a NonNullExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_non_null_expectation<T: Into<Box<NonNullExpectation>>>(
self,
v: T,
) -> Self
pub fn set_non_null_expectation<T: Into<Box<NonNullExpectation>>>( self, v: T, ) -> Self
Sets the value of rule_type
to hold a NonNullExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::NonNullExpectation;
let x = DataQualityRule::new().set_non_null_expectation(NonNullExpectation::default()/* use setters */);
assert!(x.non_null_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn set_expectation(&self) -> Option<&Box<SetExpectation>>
pub fn set_expectation(&self) -> Option<&Box<SetExpectation>>
The value of rule_type
if it holds a SetExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_set_expectation<T: Into<Box<SetExpectation>>>(self, v: T) -> Self
pub fn set_set_expectation<T: Into<Box<SetExpectation>>>(self, v: T) -> Self
Sets the value of rule_type
to hold a SetExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::SetExpectation;
let x = DataQualityRule::new().set_set_expectation(SetExpectation::default()/* use setters */);
assert!(x.set_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn regex_expectation(&self) -> Option<&Box<RegexExpectation>>
pub fn regex_expectation(&self) -> Option<&Box<RegexExpectation>>
The value of rule_type
if it holds a RegexExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_regex_expectation<T: Into<Box<RegexExpectation>>>(self, v: T) -> Self
pub fn set_regex_expectation<T: Into<Box<RegexExpectation>>>(self, v: T) -> Self
Sets the value of rule_type
to hold a RegexExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RegexExpectation;
let x = DataQualityRule::new().set_regex_expectation(RegexExpectation::default()/* use setters */);
assert!(x.regex_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn uniqueness_expectation(&self) -> Option<&Box<UniquenessExpectation>>
pub fn uniqueness_expectation(&self) -> Option<&Box<UniquenessExpectation>>
The value of rule_type
if it holds a UniquenessExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_uniqueness_expectation<T: Into<Box<UniquenessExpectation>>>(
self,
v: T,
) -> Self
pub fn set_uniqueness_expectation<T: Into<Box<UniquenessExpectation>>>( self, v: T, ) -> Self
Sets the value of rule_type
to hold a UniquenessExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::UniquenessExpectation;
let x = DataQualityRule::new().set_uniqueness_expectation(UniquenessExpectation::default()/* use setters */);
assert!(x.uniqueness_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn statistic_range_expectation(
&self,
) -> Option<&Box<StatisticRangeExpectation>>
pub fn statistic_range_expectation( &self, ) -> Option<&Box<StatisticRangeExpectation>>
The value of rule_type
if it holds a StatisticRangeExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_statistic_range_expectation<T: Into<Box<StatisticRangeExpectation>>>(
self,
v: T,
) -> Self
pub fn set_statistic_range_expectation<T: Into<Box<StatisticRangeExpectation>>>( self, v: T, ) -> Self
Sets the value of rule_type
to hold a StatisticRangeExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::StatisticRangeExpectation;
let x = DataQualityRule::new().set_statistic_range_expectation(StatisticRangeExpectation::default()/* use setters */);
assert!(x.statistic_range_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn row_condition_expectation(&self) -> Option<&Box<RowConditionExpectation>>
pub fn row_condition_expectation(&self) -> Option<&Box<RowConditionExpectation>>
The value of rule_type
if it holds a RowConditionExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_row_condition_expectation<T: Into<Box<RowConditionExpectation>>>(
self,
v: T,
) -> Self
pub fn set_row_condition_expectation<T: Into<Box<RowConditionExpectation>>>( self, v: T, ) -> Self
Sets the value of rule_type
to hold a RowConditionExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::RowConditionExpectation;
let x = DataQualityRule::new().set_row_condition_expectation(RowConditionExpectation::default()/* use setters */);
assert!(x.row_condition_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.table_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn table_condition_expectation(
&self,
) -> Option<&Box<TableConditionExpectation>>
pub fn table_condition_expectation( &self, ) -> Option<&Box<TableConditionExpectation>>
The value of rule_type
if it holds a TableConditionExpectation, None if the field is not set or
holds a different branch.
Sourcepub fn set_table_condition_expectation<T: Into<Box<TableConditionExpectation>>>(
self,
v: T,
) -> Self
pub fn set_table_condition_expectation<T: Into<Box<TableConditionExpectation>>>( self, v: T, ) -> Self
Sets the value of rule_type
to hold a TableConditionExpectation.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::TableConditionExpectation;
let x = DataQualityRule::new().set_table_condition_expectation(TableConditionExpectation::default()/* use setters */);
assert!(x.table_condition_expectation().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.sql_assertion().is_none());Sourcepub fn sql_assertion(&self) -> Option<&Box<SqlAssertion>>
pub fn sql_assertion(&self) -> Option<&Box<SqlAssertion>>
The value of rule_type
if it holds a SqlAssertion, None if the field is not set or
holds a different branch.
Sourcepub fn set_sql_assertion<T: Into<Box<SqlAssertion>>>(self, v: T) -> Self
pub fn set_sql_assertion<T: Into<Box<SqlAssertion>>>(self, v: T) -> Self
Sets the value of rule_type
to hold a SqlAssertion.
Note that all the setters affecting rule_type are
mutually exclusive.
§Example
use google_cloud_dataplex_v1::model::data_quality_rule::SqlAssertion;
let x = DataQualityRule::new().set_sql_assertion(SqlAssertion::default()/* use setters */);
assert!(x.sql_assertion().is_some());
assert!(x.range_expectation().is_none());
assert!(x.non_null_expectation().is_none());
assert!(x.set_expectation().is_none());
assert!(x.regex_expectation().is_none());
assert!(x.uniqueness_expectation().is_none());
assert!(x.statistic_range_expectation().is_none());
assert!(x.row_condition_expectation().is_none());
assert!(x.table_condition_expectation().is_none());Trait Implementations§
Source§impl Clone for DataQualityRule
impl Clone for DataQualityRule
Source§fn clone(&self) -> DataQualityRule
fn clone(&self) -> DataQualityRule
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more