Skip to main content

Crate ormkit_derive

Crate ormkit_derive 

Source
Expand description

§ormkit-derive

Procedural macros for ormkit ORM framework.

This crate provides derive macros for automatically implementing ORM traits:

  • #[derive(Entity)] - Implements the Entity trait
  • #[ormkit(table = "name")] - Specifies table name
  • #[ormkit(id)] - Marks the primary key field
  • #[ormkit(belongs_to = "Entity")] - Defines relationships

§Example

use ormkit::Entity;

#[derive(ormkit::Entity)]
#[ormkit(table = "users")]
struct User {
    #[ormkit(id)]
    id: Uuid,
    email: String,
    name: String,
}

Derive Macros§

Entity
Derive macro for implementing Entity trait