#[derive(Model)]
{
// Attributes available to this derive:
#[table_name]
#[orm_column]
}
Expand description
Re-export the Model macro for convenience Derive macro for the Model trait
Automatically implements the Model
trait for a struct, providing CRUD operations
and ORM functionality. The macro analyzes the struct fields to generate appropriate
SQL schema and conversion methods.
§Attributes:
#[table_name("custom_name")]
- Specify custom table name#[orm_column(...)]
- Configure column properties
§Examples:
use libsql_orm::Model;
use serde::{Serialize, Deserialize};
#[derive(Model, Serialize, Deserialize)]
#[table_name("users")]
struct User {
pub id: Option<i64>,
pub name: String,
pub email: String,
}