Skip to main content

toasty_driver_integration_suite/scenarios/
deferred_json_document.rs

1use crate::prelude::*;
2use serde::{Deserialize, Serialize};
3
4scenario! {
5    #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6    struct Payload {
7        name: String,
8        version: u32,
9    }
10
11    #[derive(Debug, toasty::Model)]
12    struct Repository {
13        #[key]
14        #[auto]
15        id: uuid::Uuid,
16
17        name: String,
18        #[column(type = text)]
19        payload: toasty::Deferred<toasty::Json<Payload>>,
20    }
21
22    async fn setup(test: &mut Test) -> toasty::Db {
23        test.setup_db(models!(Repository)).await
24    }
25}