fletch-orm 1.0.0

Lightweight database toolkit built on SQLx
Documentation
//! Column metadata for schema representation.

/// The data type of a column.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ColumnType {
    Text,
    Integer,
    Float,
    Boolean,
    Timestamp,
    Uuid,
    Json,
    Blob,
}

/// A column in a database table.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Column {
    name: &'static str,
    column_type: ColumnType,
}

impl Column {
    /// Create a new column definition.
    pub const fn new(name: &'static str, column_type: ColumnType) -> Self {
        Self { name, column_type }
    }

    /// The column name.
    pub fn name(&self) -> &str {
        self.name
    }

    /// The column data type.
    pub fn column_type(&self) -> ColumnType {
        self.column_type
    }
}