1 unstable release
0.1.0 | May 5, 2024 |
---|
#1747 in Data structures
18KB
413 lines
db-meta-derive
db-meta-derive is a wrapper around PostgresSOL using tokio-postgres.
Examples
Schema
#[derive(PostgresMapper, Deserialize, PostgresMeta)]
#[pg_mapper(table = "test")]
struct Test {
#[id]
id: i64,
title: Option<String>,
create_time: Option<SystemTime>,
update_time: Option<SystemTime>,
}
Usage
pub fn test() {
let meta = Test::meta();
println!("{:?}", meta);
// ("test", [("id", "bigserial primary key", 0, "", true), ("title", "varchar", 0, "", false), ("create_time", "timestamp", 0, "", false), ("update_time", "timestamp", 0, "", false)])
}
Dependencies
~1.8–2.9MB
~61K SLoC