ormkit-derive
Derive macros for the ormkit ORM library.
Installation
[]
= "0.1"
= "0.1"
Derive Macros
Entity
The Entity derive macro automatically implements the Entity trait and generates an ActiveModel for your structs.
Attributes
#[ormkit(table = "table_name")]- Specifies the database table name#[ormkit(id)]- Marks a field as the primary key
Generated Code
The derive macro generates:
- Entity trait implementation - Provides database metadata for the entity
- ActiveModel - Tracks field changes for efficient partial updates
- Table metadata - Column names, types, and constraints
Example
use ;
use ActiveValue;
// Use the generated ActiveModel
let mut user = default;
user.email = Set;
user.name = Set;
License
MIT OR Apache-2.0
See Also
- ormkit - Main ORM library