-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: support for diesel @ 2.2 #404
Conversation
src/lib.rs
Outdated
@@ -144,6 +144,8 @@ pub mod nightly { | |||
/// | |||
/// [std-overflow]: https://doc.rust-lang.org/reference/expressions/operator-expr.html#overflow | |||
#[derive(Clone, Copy, Eq, PartialEq, Hash)] | |||
#[cfg_attr(feature = "diesel", derive(diesel::AsExpression, diesel::FromSqlRow))] | |||
#[cfg_attr(feature = "diesel", diesel(sql_type = diesel::sql_types::Binary))] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer not to have these leak into the codebase, is it possible to expand these and include them in the support/diesel.rs
file? How many LoC would that add?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool. I will review, and may do a style pass on the generated code if you don't mind
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes of course, feel free-- I mostly kept it the same as the generated code, minus deduping some long namespaced variables. Lmk if I can adjust anything else! 🫡
Thanks James 😁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM :)
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 | |||
|
|||
### Added | |||
|
|||
- Support for diesel @ 2.2 ([#404]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pr not found 😂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I fixed the link)
why does it merge if clippy fails -_- |
Motivation
I noticed there were some comment notes in the repo indicating a desire for diesel support. I had implemented something similar using a newtype pattern in my own project, so I figured I'd attempt to contribute it back upstream.
Solution
This PR implements the required traits for the generic uint types to work out of the box with diesel. The implementation closely matches the sqlx feature implementation in this repo. I have an example repo illustrating simple usage (schema, querying, inserting) @ https://github.com/sinasab/diesel_uint_test/.
PR Checklist