File tree Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Expand file tree Collapse file tree 2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -151,3 +151,11 @@ mod decimal_types {
151151 impl_any_encode ! ( Decimal ) ;
152152 impl_any_decode ! ( Decimal ) ;
153153}
154+
155+ #[ cfg( feature = "uuid" ) ]
156+ mod uuid_types {
157+ use uuid:: Uuid ;
158+ impl_any_type ! ( Uuid ) ;
159+ impl_any_encode ! ( Uuid ) ;
160+ impl_any_decode ! ( Uuid ) ;
161+ }
Original file line number Diff line number Diff line change @@ -112,6 +112,23 @@ async fn it_has_json() -> anyhow::Result<()> {
112112 Ok ( ( ) )
113113}
114114
115+ #[ cfg( feature = "uuid" ) ]
116+ #[ sqlx_macros:: test]
117+ async fn it_has_uuid ( ) -> anyhow:: Result < ( ) > {
118+ use sqlx_oldapi:: types:: Uuid ;
119+ #[ cfg( feature = "sqlite" ) ]
120+ let sql = "CAST('123e4567-e89b-12d3-a456-426614174000' AS TEXT)" ;
121+ #[ cfg( feature = "mssql" ) ]
122+ let sql = "CONVERT(uniqueidentifier, '123e4567-e89b-12d3-a456-426614174000')" ;
123+ #[ cfg( feature = "postgres" ) ]
124+ let sql = "CAST('123e4567-e89b-12d3-a456-426614174000' AS UUID)" ;
125+ assert_eq ! (
126+ Uuid :: parse_str( "123e4567-e89b-12d3-a456-426614174000" ) ?,
127+ get_val:: <Uuid >( sql) . await ?
128+ ) ;
129+ Ok ( ( ) )
130+ }
131+
115132#[ sqlx_macros:: test]
116133async fn it_pings ( ) -> anyhow:: Result < ( ) > {
117134 let mut conn = new :: < Any > ( ) . await ?;
You can’t perform that action at this time.
0 commit comments