@@ -697,6 +697,45 @@ test_type!(ltree_vec<Vec<sqlx::postgres::types::PgLTree>>(Postgres,
697697 ]
698698) ) ;
699699
700+ #[ derive( sqlx:: Type , Debug , PartialEq ) ]
701+ #[ sqlx( type_name = "positive_int" ) ]
702+ struct PositiveInt ( i32 ) ;
703+
704+ #[ derive( sqlx:: Type , Debug , PartialEq ) ]
705+ #[ sqlx( type_name = "percentage" ) ]
706+ struct Percentage ( PositiveInt ) ;
707+
708+ #[ derive( sqlx:: Type , Debug , PartialEq ) ]
709+ struct Person {
710+ id : i32 ,
711+ age : PositiveInt ,
712+ percent : Percentage ,
713+ }
714+
715+ test_type ! ( nested_domain_types_1<Person >( Postgres ,
716+ "ROW(1, 21::positive_int, 50::percentage)::person" == Person { id: 1 , age: PositiveInt ( 21 ) , percent: Percentage ( PositiveInt ( 50 ) ) } )
717+ ) ;
718+
719+ #[ derive( sqlx:: Type , Debug , PartialEq ) ]
720+ #[ sqlx( type_name = "leaf_composite" ) ]
721+ struct LeafComposite {
722+ prim : i32 ,
723+ }
724+
725+ #[ derive( sqlx:: Type , Debug , PartialEq ) ]
726+ #[ sqlx( type_name = "domain" ) ]
727+ struct Domain ( LeafComposite ) ;
728+
729+ #[ derive( sqlx:: Type , Debug , PartialEq ) ]
730+ #[ sqlx( type_name = "root_composite" ) ]
731+ struct RootComposite {
732+ domain : Domain ,
733+ }
734+
735+ test_type ! ( nested_domain_types_2<RootComposite >( Postgres ,
736+ "ROW(ROW(1))::root_composite" == RootComposite { domain: Domain ( LeafComposite { prim: 1 } ) } )
737+ ) ;
738+
700739test_type ! ( test_arc<Arc <i32 >>( Postgres , "1::INT4" == Arc :: new( 1i32 ) ) ) ;
701740test_type ! ( test_cow<Cow <' _, i32 >>( Postgres , "1::INT4" == Cow :: <i32 >:: Owned ( 1i32 ) ) ) ;
702741test_type ! ( test_box<Box <i32 >>( Postgres , "1::INT4" == Box :: new( 1i32 ) ) ) ;
0 commit comments