Crates.io | sea-orm-typed-id |
lib.rs | sea-orm-typed-id |
version | 0.2.0 |
source | src |
created_at | 2024-11-10 12:14:16.564823 |
updated_at | 2024-11-10 13:58:06.39418 |
description | A Rust library that provides a macro for generating type-safe database ID types for SeaORM. |
homepage | |
repository | https://github.com/reneklacan/sea-orm-typed-id |
max_upload_size | |
id | 1442844 |
size | 9,525 |
A Rust library that provides a macro for generating type-safe database ID types for SeaORM.
You might not actually need this library; it’s just a macro, and you might be better off simply copying the code from src/lib.rs into your project.
all
: Enables all featuresrustls
: Enables rustls TLS backend for SeaORMpostgres
: Enables PostgreSQL array supportutoipa
: Enables OpenAPI schema generation supportAdd this to your Cargo.toml
:
[dependencies]
sea-orm-typed-id = { version = "0.1.0", features = ["all"] }
use sea_orm_typed_id::define_id;
define_id!(CakeId);
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "cakes")]
pub struct Cake {
pub id: CakeId,
}
define_id!(FillingId);
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "fillings")]
pub struct Filling {
pub id: FillingId,
}
#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel)]
#[sea_orm(table_name = "cake_fillings")]
pub struct CakeFilling {
pub cake_id: CakeId,
pub filling_id: FillingId,
}
This project is licensed under the MIT License. See the LICENSE file for details.