pub struct Column {Show 14 fields
pub name: String,
pub data_type: String,
pub nullable: bool,
pub primary_key: bool,
pub secondary_key: bool,
pub composite_key: Option<String>,
pub foreign_key: Option<ForeignKey>,
pub constraints: Vec<String>,
pub description: String,
pub errors: Vec<HashMap<String, Value>>,
pub quality: Vec<HashMap<String, Value>>,
pub ref_path: Option<String>,
pub enum_values: Vec<String>,
pub column_order: i32,
}Expand description
Column model representing a field in a table
A column defines a single field with a data type, constraints, and optional metadata. Columns can be primary keys, foreign keys, nullable, and have various constraints.
§Example
use data_modelling_sdk::models::Column;
let column = Column::new("id".to_string(), "INT".to_string());Fields§
§name: StringColumn name
data_type: StringData type (e.g., “INT”, “VARCHAR(100)”, “TIMESTAMP”)
nullable: boolWhether the column allows NULL values (default: true)
primary_key: boolWhether this column is part of the primary key (default: false)
secondary_key: boolWhether this column is a secondary key (default: false)
composite_key: Option<String>Composite key name if this column is part of a composite key
foreign_key: Option<ForeignKey>Foreign key reference if this column references another table
constraints: Vec<String>Additional constraints (e.g., “CHECK”, “UNIQUE”)
description: StringColumn description/documentation
errors: Vec<HashMap<String, Value>>Validation errors and warnings
quality: Vec<HashMap<String, Value>>Quality rules and checks
ref_path: Option<String>JSON Schema $ref reference path
enum_values: Vec<String>Enum values if this column is an enumeration type
column_order: i32Display order for UI rendering
Implementations§
Source§impl Column
impl Column
Sourcepub fn new(name: String, data_type: String) -> Self
pub fn new(name: String, data_type: String) -> Self
Create a new column with the given name and data type
§Arguments
name- The column name (must be valid according to naming conventions)data_type- The data type string (e.g., “INT”, “VARCHAR(100)”)
§Returns
A new Column instance with default values (nullable=true, primary_key=false).
§Example
use data_modelling_sdk::models::Column;
let col = Column::new("user_id".to_string(), "BIGINT".to_string());