#mq #redis #http #web

macro tardis-macros

Elegant, clean Rust development framework

25 releases

0.1.0-rc.17 Oct 18, 2024
0.1.0-rc.16 Jun 26, 2024
0.1.0-rc.15 May 9, 2024
0.1.0-rc.10 Mar 20, 2024
0.1.0-alpha30 Nov 29, 2022

#14 in #mq

Download history 15/week @ 2024-08-22 12/week @ 2024-08-29 3/week @ 2024-09-05 6/week @ 2024-09-12 9/week @ 2024-09-19 12/week @ 2024-09-26 3/week @ 2024-10-03 190/week @ 2024-10-17 21/week @ 2024-10-24 23/week @ 2024-10-31 14/week @ 2024-11-07 8/week @ 2024-11-14 15/week @ 2024-11-21 19/week @ 2024-11-28 18/week @ 2024-12-05

60 downloads per month
Used in 5 crates (via tardis)

MIT/Apache

50KB
948 lines

Tardis-Macros

Tardis-Macros is a macro support library for the Tardis framework, providing additional macros to simplify code generation for DTO (Data Transfer Object) with sea_orm.

Main Macros

  • TardisCreateEntity: Generates code to create entities, combining TardisCreateIndex and TardisCreateTable.

Features

Tardis-Macros supports the following features, which enable the usage of specific macros:

Feature Macro
reldb-postgresorreldb-mysqlorreldb-sqlite TardisCreateTable
reldb-postgresorreldb-mysqlorreldb-sqlite TardisCreateIndex
reldb-postgresorreldb-mysqlorreldb-sqlite TardisCreateEntity
reldb-postgresorreldb-mysqlorreldb-sqlite TardisEmptyBehavior
reldb-postgresorreldb-mysqlorreldb-sqlite TardisEmptyRelation

Please note that the availability of each macro depends on the enabled features. Make sure to enable the corresponding feature to use the desired macro.

How to Use

Best Practices

Add the TardisCreateEntity macro to your struct definition, along with other necessary derive macros like DeriveEntityModel, TardisEmptyBehavior, and TardisEmptyRelation.

Example usage:

#[derive(Clone, Debug, PartialEq, Eq, DeriveEntityModel, TardisCreateEntity, TardisEmptyBehavior, TardisEmptyRelation)]
#[sea_orm(table_name = "examples")]
pub struct Model {
    #[sea_orm(primary_key, auto_increment = false)]
    pub id: String,
    #[index]
    #[fill_ctx(own_paths)]
    pub aaa: String,
}

You also can refer to the example code and test cases for the best practices on using the Tardis-Macros library.

For more examples and detailed usage, please refer to the documentation of each specific macro.

[TardisCreateEntity]

Dependencies

~0.8–1.3MB
~28K SLoC