Skip to content

Commit 1062c27

Browse files
committed
Merge pull request #4063 from sugar700/allow-type-name-conflicting-with-trait-in-queryable
Allow Field and Row types with Queryable derive
1 parent 5c870f7 commit 1062c27

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

diesel_derives/src/queryable.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ pub fn derive(item: DeriveInput) -> Result<TokenStream> {
4646

4747
Ok(wrap_in_dummy_mod(quote! {
4848
use diesel::deserialize::{self, FromStaticSqlRow, Queryable};
49-
use diesel::row::{Row, Field};
49+
use diesel::row::{Row as _, Field as _};
5050
use std::convert::TryInto;
5151

5252
impl #impl_generics Queryable<(#(#sql_type,)*), __DB> for #struct_name #ty_generics

diesel_derives/tests/queryable.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,16 @@ fn multiple_tables() {
8787
data
8888
);
8989
}
90+
91+
#[test]
92+
fn name_conflict() {
93+
type Field = i32;
94+
type Record = i32;
95+
96+
#[derive(Debug, Clone, PartialEq, Eq, Queryable)]
97+
struct MyStruct(Field, Record);
98+
99+
let conn = &mut connection();
100+
let data = select(sql::<(Integer, Integer)>("1, 2")).get_result(conn);
101+
assert_eq!(Ok(MyStruct(1, 2)), data);
102+
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy