2 releases
new 0.1.2 | Nov 16, 2024 |
---|---|
0.1.1 | Nov 16, 2024 |
0.1.0 |
|
#974 in Rust patterns
247 downloads per month
6KB
68 lines
sql-table-macros
Helper macros to auto add sql table common fields to struct definition
Example
#![allow(dead_code)]
use sql_table_macros::table_common_fields;
type Id = u64;
#[table_common_fields(Id, std::time::Duration)]
#[derive(Default, Debug)]
struct User {
id: String,
name: String,
}
fn main() {
let user = User::default();
assert_eq!(
format!("{user:?}"),
r#"User { id: "", name: "", created_by: 0, updated_by: 0, created_at: 0ns, updated_at: 0ns, is_deleted: false }"#
);
}
Dependencies
~2MB
~46K SLoC