Skip to content

Commit 828d68e

Browse files
committed
fix: compiler errors in tests/postgres
1 parent 67177f2 commit 828d68e

1 file changed

Lines changed: 13 additions & 16 deletions

File tree

tests/postgres/derives.rs

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,19 @@ struct InventoryItem {
145145
#[sqlx(type_name = "float_range")]
146146
struct FloatRange(PgRange<f64>);
147147

148-
// Custom domain type
149-
#[derive(sqlx::Type, Debug)]
150-
#[sqlx(type_name = "int4rangeL0pC")]
151-
struct RangeInclusive(PgRange<i32>);
148+
// Manual `PgHasArrayType` impl
149+
#[derive(sqlx::Type)]
150+
#[sqlx(no_pg_array)]
151+
pub struct User {
152+
pub id: i32,
153+
pub username: String,
154+
}
155+
156+
impl PgHasArrayType for User {
157+
fn array_type_info() -> sqlx::postgres::PgTypeInfo {
158+
sqlx::postgres::PgTypeInfo::array_of("User")
159+
}
160+
}
152161

153162
test_type!(transparent_tuple<Transparent>(Postgres,
154163
"0" == Transparent(0),
@@ -809,18 +818,6 @@ async fn test_from_row_hygiene() -> anyhow::Result<()> {
809818

810819
#[sqlx_macros::test]
811820
async fn test_custom_pg_array() -> anyhow::Result<()> {
812-
#[derive(sqlx::Type)]
813-
#[sqlx(no_pg_array)]
814-
pub struct User {
815-
pub id: i32,
816-
pub username: String,
817-
}
818-
819-
impl PgHasArrayType for User {
820-
fn array_type_info() -> sqlx::postgres::PgTypeInfo {
821-
sqlx::postgres::PgTypeInfo::array_of("User")
822-
}
823-
}
824821
Ok(())
825822
}
826823

0 commit comments

Comments
 (0)