Skip to content

Commit ab807ad

Browse files
authored
Update custom_types.rs
1 parent 1551549 commit ab807ad

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

tests/custom_types.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::connection;
22
use diesel::deserialize::{self, FromSql, FromSqlRow};
3-
use diesel::expression::AsExpression;
3+
use diesel::expression::{AsExpression, IntoSql};
44
use diesel::pg::{Pg, PgValue};
55
use diesel::serialize::{self, IsNull, Output, ToSql};
66
use diesel::sql_types::SqlType;
@@ -68,6 +68,14 @@ async fn custom_types_round_trip() {
6868
},
6969
];
7070
let connection = &mut connection().await;
71+
72+
// Try encoding an array to test type metadata lookup
73+
let selected = select([MyEnum::Foo, MyEnum::Bar].into_sql::<sql_types::Array<MyType>>())
74+
.get_result(connection)
75+
.await
76+
.unwrap();
77+
assert_eq!(vec![MyEnum::Foo, MyEnum::Bar], selected);
78+
7179
connection
7280
.batch_execute(
7381
r#"

0 commit comments

Comments
 (0)