macro_rules! try_create_table {
($($x:ty),+) => { ... };
}Expand description
Creates a table for the specified Model.
This is just a more convenient api
for the [try_create_table()] function.
Returns an error if:
- a table with the same name already exists,
- the client is not connected,
- the creation of the table fails.
§Usage
ⓘ
use pg_worm::prelude::*;
#[derive(Model)]
struct Foo {
id: i64
}
#[derive(Model)]
struct Bar {
baz: String
}
#[tokio::main]
async fn main() -> Result<(), pg_worm::Error> {
// ---- snip connection setup ----
try_create_table!(Foo, Bar)?;
}