Skip to content

qyuzh/sql-table-macros

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 }"#
    );
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages