craken-database 0.1.1

SQLx-powered database abstraction and ORM for the Craken framework.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
/// Core Model trait for ORM-like functionality.
///
/// The `#[derive(Model)]` macro will provide the default implementations
/// for `table_name` and standard CRUD operations.
pub trait Model: Send + Sync + Unpin + 'static + for<'r> ::sqlx::FromRow<'r, ::sqlx::postgres::PgRow> + ::serde::Serialize {
    /// The database table name for this model.
    fn table_name() -> &'static str;

    /// Primary key column name (defaults to "id").
    fn primary_key() -> &'static str {
        "id"
    }
}