zino_orm/
entity.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use std::fmt::Display;
use zino_core::model::Model;

/// An interface for the model entity.
pub trait Entity: Model {
    /// The column type.
    type Column: AsRef<str> + Display;

    /// The primary key column.
    const PRIMARY_KEY: Self::Column;

    /// Formats the column name.
    #[inline]
    fn format_column(col: &Self::Column) -> String {
        [Self::MODEL_NAME, ".", col.as_ref()].concat()
    }
}