| Crates.io | tideorm-macros |
| lib.rs | tideorm-macros |
| version | 0.4.5 |
| created_at | 2026-01-08 14:32:34.201502+00 |
| updated_at | 2026-01-17 22:40:58.046733+00 |
| description | Procedural macros for TideORM |
| homepage | |
| repository | https://github.com/mohamadzoh/tideorm |
| max_upload_size | |
| id | 2030317 |
| size | 78,016 |
Procedural macros for TideORM.
This crate provides derive macros to simplify defining ORM models in TideORM. Instead of manually implementing traits, you can use the #[derive(Model)] macro to automatically generate the necessary implementations.
This crate is typically used as a dependency of the main tideorm crate. If you need to use it directly:
[dependencies]
tideorm-macros = "0.4.5"
use tideorm_macros::Model;
#[derive(Model)]
#[tide(table = "users")]
pub struct User {
#[tide(primary_key, auto_increment)]
pub id: i64,
pub name: String,
pub email: String,
}
| Attribute | Description |
|---|---|
#[tide(primary_key)] |
Mark field as primary key |
#[tide(auto_increment)] |
Enable auto-increment for primary keys |
#[tide(column = "name")] |
Override the database column name |
#[tide(nullable)] |
Mark field as nullable |
#[tide(default = "expr")] |
Set a default value expression |
#[tide(skip)] |
Skip this field in queries |
#[tide(timestamp)] |
Mark as timestamp field (created_at, updated_at) |
| Attribute | Description |
|---|---|
#[tide(has_one = "Model")] |
Define a has-one relationship |
#[tide(has_many = "Model")] |
Define a has-many relationship |
#[tide(belongs_to = "Model")] |
Define a belongs-to relationship |
#[tide(has_many_through = "Model")] |
Define a has-many-through relationship |
#[tide(foreign_key = "col")] |
Specify the foreign key column |
#[tide(owner_key = "col")] |
Specify the owner/local key |
#[tide(pivot = "table")] |
Specify pivot table for many-to-many |
MIT