2 unstable releases
Uses new Rust 2024
new 0.2.0 | May 17, 2025 |
---|---|
0.1.4 | May 16, 2025 |
#523 in Procedural macros
180 downloads per month
6KB
54 lines
This version, have no any difference compared with version 0.1.4 and 0.1.3 , except for the
revised documention.
A simple macro to generate a specified sql when we have a struct A.
For example:
#[derive(TableCreator)]
struct A <'a, T>{
#[table_ignore]
a: i32,
b: String,
c: &'a T
}
printfln!("{}", A::<'somelifetime, SomeType>::table_creat_sql()}
the output is :
CREATE TABLE IF NOT EXISTS A (id SERIAL PRIMARY KEY, b TEXT , c SomeMatchedSqlType )
The elements , with #[table_ignore], will be ignored.
It just support some Sqlite's sql types:
i32| u32 | i64 | u64 => INTEGER,
f32 => REAL
f64 => REAL
String | str => TEXT
bool => BOOLEAN
NaiveDate => DATE
NaiveDateTime => TIMESTAMP
Dependencies
~185–610KB
~14K SLoC