Skip to main content

toasty_driver_integration_suite/scenarios/
document_optional_body_deferred.rs

1use crate::prelude::*;
2
3scenario! {
4    #[derive(Debug, toasty::Model)]
5    struct Document {
6        #[key]
7        #[auto]
8        id: uuid::Uuid,
9
10        title: String,
11
12        // Newtype embed whose single field is deferred — the nullable head
13        // reuses that one (deferred) leaf column.
14        body: Option<Body>,
15    }
16
17    #[derive(Debug, toasty::Embed)]
18    struct Body(toasty::Deferred<String>);
19
20    async fn setup(test: &mut Test) -> toasty::Db {
21        test.setup_db(models!(Document)).await
22    }
23}