Skip to main content

dataprof_core/
semantic.rs

1/// User-supplied semantic hints that affect profiling and quality metrics.
2#[derive(Debug, Clone, Default, PartialEq, Eq)]
3pub struct SemanticHints {
4    pub positive_columns: Vec<String>,
5    pub identifier_columns: Vec<String>,
6}
7
8impl SemanticHints {
9    pub fn new(positive_columns: Vec<String>, identifier_columns: Vec<String>) -> Self {
10        Self {
11            positive_columns,
12            identifier_columns,
13        }
14    }
15
16    pub fn is_empty(&self) -> bool {
17        self.positive_columns.is_empty() && self.identifier_columns.is_empty()
18    }
19
20    pub fn is_identifier_column(&self, column_name: &str) -> bool {
21        self.identifier_columns
22            .iter()
23            .any(|candidate| candidate == column_name)
24    }
25
26    pub fn is_positive_column(&self, column_name: &str) -> bool {
27        self.positive_columns
28            .iter()
29            .any(|candidate| candidate == column_name)
30    }
31}