File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -145,10 +145,19 @@ struct InventoryItem {
145145#[ sqlx( type_name = "float_range" ) ]
146146struct 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
153162test_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]
811820async 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
You can’t perform that action at this time.
0 commit comments