@@ -713,6 +713,22 @@ test_type!(nested_domain_types_1<Person>(Postgres,
713
713
"ROW(1, 21::positive_int, 50::percentage)::person" == Person { id: 1 , age: PositiveInt ( 21 ) , percent: Percentage ( PositiveInt ( 50 ) ) } )
714
714
) ;
715
715
716
+ test_type ! ( domain_type_array_1<Vec <PositiveInt >>( Postgres ,
717
+ "ARRAY[1, 50, 1000]::positive_int[]" == vec![
718
+ PositiveInt ( 1 ) ,
719
+ PositiveInt ( 50 ) ,
720
+ PositiveInt ( 1000 ) ,
721
+ ] ,
722
+ ) ) ;
723
+
724
+ test_type ! ( domain_type_array_2<Vec <Percentage >>( Postgres ,
725
+ "ARRAY[4, 66, 100]::percentage[]" == vec![
726
+ Percentage ( PositiveInt ( 4 ) ) ,
727
+ Percentage ( PositiveInt ( 66 ) ) ,
728
+ Percentage ( PositiveInt ( 100 ) )
729
+ ] ,
730
+ ) ) ;
731
+
716
732
#[ derive( sqlx:: Type , Debug , PartialEq ) ]
717
733
#[ sqlx( type_name = "leaf_composite" ) ]
718
734
struct LeafComposite {
@@ -730,9 +746,17 @@ struct RootComposite {
730
746
}
731
747
732
748
test_type ! ( nested_domain_types_2<RootComposite >( Postgres ,
733
- "ROW(ROW(1))::root_composite" == RootComposite { domain: Domain ( LeafComposite { prim: 1 } ) } )
749
+ "ROW(ROW(1))::root_composite" == RootComposite { domain: Domain ( LeafComposite { prim: 1 } ) } )
734
750
) ;
735
751
752
+ test_type ! ( domain_type_array_3<Vec <Domain >>( Postgres ,
753
+ "ARRAY[ROW(50), ROW(1), ROW(1000)]::domain[]" == vec![
754
+ Domain ( LeafComposite { prim: 50 } ) ,
755
+ Domain ( LeafComposite { prim: 1 } ) ,
756
+ Domain ( LeafComposite { prim: 1000 } ) ,
757
+ ]
758
+ ) ) ;
759
+
736
760
test_type ! ( test_arc<Arc <i32 >>( Postgres , "1::INT4" == Arc :: new( 1i32 ) ) ) ;
737
761
test_type ! ( test_cow<Cow <' _, i32 >>( Postgres , "1::INT4" == Cow :: <i32 >:: Owned ( 1i32 ) ) ) ;
738
762
test_type ! ( test_box<Box <i32 >>( Postgres , "1::INT4" == Box :: new( 1i32 ) ) ) ;
0 commit comments