Function pg_worm::register_model
source · pub async fn register_model<M: Model<M>>() -> Result<(), Error>where
Error: From<<M as TryFrom<Row>>::Error>,Expand description
Register your model with the database. This creates a table representing your model.
Use the register! macro for a more convenient api.
Usage
ⓘ
#[derive(Model)]
struct Foo {
#[column(primary_key)]
id: i64
}
#[tokio::main]
async fn main() -> Result<(), pg_worm::Error> {
// ---- snip connection setup ----
pg_worm::register_model::<M>().await?;
}