1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/// Inferred column data type.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
pub enum DataType {
/// Text or string values.
String,
/// Identifier values that should be treated as semantic strings.
Identifier,
/// Whole numbers in the i64 range.
Integer,
/// Floating-point numbers.
Float,
/// Date or datetime values.
Date,
/// Boolean values.
Boolean,
}
/// Semantic category for a detected pattern.
#[derive(Debug, Clone, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum PatternCategory {
/// Email addresses, phone numbers.
Contact,
/// UUIDs, fiscal codes, tax IDs.
Identifier,
/// IPv4, IPv6, MAC addresses, URLs.
Network,
/// Coordinates and postal codes.
Geographic,
/// IBANs, credit cards, SWIFT/BIC.
Financial,
/// Unix or Windows file paths.
FilePath,
/// Uncategorized patterns.
Other,
}
impl std::fmt::Display for PatternCategory {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Self::Contact => write!(f, "contact"),
Self::Identifier => write!(f, "identifier"),
Self::Network => write!(f, "network"),
Self::Geographic => write!(f, "geographic"),
Self::Financial => write!(f, "financial"),
Self::FilePath => write!(f, "file_path"),
Self::Other => write!(f, "other"),
}
}
}