#macros #orm #mariadb #sqlx #proc-macro #derive-macro #unique-id #id #macro

ormx

lightweight procedural macros bringing orm-like features to sqlx

22 releases (8 breaking)

0.10.0 Sep 24, 2021
0.8.0 Sep 21, 2021
0.7.0 Mar 29, 2021
0.2.0 Nov 19, 2020

#1757 in Database interfaces

Download history 17/week @ 2023-06-02 11/week @ 2023-06-09 47/week @ 2023-06-16 27/week @ 2023-06-23 59/week @ 2023-06-30 22/week @ 2023-07-07 23/week @ 2023-07-14 33/week @ 2023-07-21 32/week @ 2023-07-28 22/week @ 2023-08-04 24/week @ 2023-08-11 787/week @ 2023-08-18 1262/week @ 2023-08-25 23/week @ 2023-09-01 60/week @ 2023-09-08 19/week @ 2023-09-15

1,606 downloads per month

MIT license

28KB
665 lines

ormx

please take a look at the repository and the documentation


lib.rs:

Lightweight derive macros for bringing orm-like features to sqlx.

Example: Table

#[derive(ormx::Table)]
#[ormx(table = "users", id = user_id, insertable)]
struct User {
    #[ormx(column = "id")]
    user_id: u32,
    first_name: String,
    last_name: String,
    #[ormx(get_optional(&str))]
    email: String,
    #[ormx(default, set)]
    last_login: Option<NaiveDateTime>,
}

Example: Patch

#[derive(ormx::Patch)]
#[ormx(table_name = "users", table = User, id = "id")]
struct UpdateName {
    first_name: String,
    last_name: String,
}

Documentation

See the docs of derive(Table) and Patch.

Dependencies

~9–27MB
~469K SLoC