feat: support for diesel @ 2.2#404
Merged
Merged
Conversation
prestwich
reviewed
Nov 10, 2024
| /// [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))] |
Member
There was a problem hiding this comment.
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?
Contributor
Author
Member
There was a problem hiding this comment.
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.
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 😁
prestwich
approved these changes
Nov 12, 2024
|
|
||
| ### Added | ||
|
|
||
| - Support for diesel @ 2.2 ([#404]) |
Member
|
why does it merge if clippy fails -_- |
Closed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

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