-
-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(derive): add
#[postgres(allow_mismatch)]
- Loading branch information
1 parent
8b9b5d0
commit 3d92ed1
Showing
8 changed files
with
207 additions
and
7 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
postgres-derive-test/src/compile-fail/invalid-allow-mismatch.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
use postgres_types::{FromSql, ToSql}; | ||
|
||
#[derive(ToSql, Debug)] | ||
#[postgres(allow_mismatch)] | ||
struct ToSqlAllowMismatchStruct { | ||
a: i32, | ||
} | ||
|
||
#[derive(FromSql, Debug)] | ||
#[postgres(allow_mismatch)] | ||
struct FromSqlAllowMismatchStruct { | ||
a: i32, | ||
} | ||
|
||
#[derive(ToSql, Debug)] | ||
#[postgres(allow_mismatch)] | ||
struct ToSqlAllowMismatchTupleStruct(i32, i32); | ||
|
||
#[derive(FromSql, Debug)] | ||
#[postgres(allow_mismatch)] | ||
struct FromSqlAllowMismatchTupleStruct(i32, i32); | ||
|
||
fn main() {} |
31 changes: 31 additions & 0 deletions
31
postgres-derive-test/src/compile-fail/invalid-allow-mismatch.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
error: #[postgres(allow_mismatch)] may only be applied to enums | ||
--> src/compile-fail/invalid-allow-mismatch.rs:4:1 | ||
| | ||
4 | / #[postgres(allow_mismatch)] | ||
5 | | struct ToSqlAllowMismatchStruct { | ||
6 | | a: i32, | ||
7 | | } | ||
| |_^ | ||
|
||
error: #[postgres(allow_mismatch)] may only be applied to enums | ||
--> src/compile-fail/invalid-allow-mismatch.rs:10:1 | ||
| | ||
10 | / #[postgres(allow_mismatch)] | ||
11 | | struct FromSqlAllowMismatchStruct { | ||
12 | | a: i32, | ||
13 | | } | ||
| |_^ | ||
|
||
error: #[postgres(allow_mismatch)] may only be applied to enums | ||
--> src/compile-fail/invalid-allow-mismatch.rs:16:1 | ||
| | ||
16 | / #[postgres(allow_mismatch)] | ||
17 | | struct ToSqlAllowMismatchTupleStruct(i32, i32); | ||
| |_______________________________________________^ | ||
|
||
error: #[postgres(allow_mismatch)] may only be applied to enums | ||
--> src/compile-fail/invalid-allow-mismatch.rs:20:1 | ||
| | ||
20 | / #[postgres(allow_mismatch)] | ||
21 | | struct FromSqlAllowMismatchTupleStruct(i32, i32); | ||
| |_________________________________________________^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters