toasty_driver_integration_suite/scenarios/
character_creature.rs1use crate::prelude::*;
2
3scenario! {
4 #[derive(Debug, toasty::Model)]
5 #[allow(dead_code)]
6 struct Character {
7 #[key]
8 #[auto]
9 id: uuid::Uuid,
10
11 creature: Creature,
12 }
13
14 #[derive(Debug, PartialEq, toasty::Embed)]
19 enum Creature {
20 #[column(variant = 1)]
21 Human {
22 #[shared(name)]
23 name: String,
24 profession: String,
25 },
26 #[column(variant = 2)]
27 Animal {
28 #[shared(name)]
29 name: String,
30 species: String,
31 },
32 }
33
34 async fn setup(test: &mut Test) -> toasty::Db {
35 test.setup_db(models!(Character)).await
36 }
37}