Skip to content

Commit 1da6fea

Browse files
committed
postgres: use inventory_item from fixture ( still need type name resolution for the test to work reliably )
1 parent a3f7029 commit 1da6fea

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

tests/postgres-derives.rs

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,11 @@ enum Strong {
3232
// Records must map to a custom type
3333
// Note that all types are types in Postgres
3434
// #[derive(PartialEq, Debug, sqlx::Type)]
35-
// #[sqlx(postgres(oid = 12184))]
36-
// struct PgConfig {
35+
// #[sqlx(postgres(oid = ?))]
36+
// struct InventoryItem {
3737
// name: String,
38-
// setting: Option<String>,
38+
// supplier_id: Option<i32>,
39+
// price: Option<i64>
3940
// }
4041

4142
test_type!(transparent(
@@ -64,23 +65,23 @@ test_type!(strong_enum(
6465
// TODO: Figure out a good solution for custom type testing
6566
// test_type!(record_pg_config(
6667
// Postgres,
67-
// PgConfig,
68-
// // (CC,gcc)
69-
// "(SELECT ROW('CC', 'gcc')::pg_config)"
70-
// == PgConfig {
71-
// name: "CC".to_owned(),
72-
// setting: Some("gcc".to_owned()),
68+
// InventoryItem,
69+
// "(SELECT ROW('fuzzy dice', 42, 199)::inventory_item)"
70+
// == InventoryItem {
71+
// name: "fuzzy dice".to_owned(),
72+
// supplier_id: Some(42),
73+
// price: Some(199),
7374
// },
74-
// // (CC,)
75-
// "(SELECT '(\"CC\",)'::pg_config)"
76-
// == PgConfig {
77-
// name: "CC".to_owned(),
78-
// setting: None,
75+
// "(SELECT '(\"fuuzy dice\",,)'::pg_config)"
76+
// == InventoryItem {
77+
// name: "fuzzy dice".to_owned(),
78+
// supplier_id: None,
79+
// price: None,
7980
// },
80-
// // (CC,"")
81-
// "(SELECT '(\"CC\",\"\")'::pg_config)"
82-
// == PgConfig {
83-
// name: "CC".to_owned(),
84-
// setting: Some("".to_owned()),
81+
// "(SELECT '(\"\",,2350)'::pg_config)"
82+
// == InventoryItem {
83+
// name: "".to_owned(),
84+
// supplier_id: None,
85+
// price: Some(2350)
8586
// }
8687
// ));

0 commit comments

Comments
 (0)