Skip to content
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

Support for Diesel 2.0? #2

Closed
phayes opened this issue Aug 20, 2022 · 6 comments
Closed

Support for Diesel 2.0? #2

phayes opened this issue Aug 20, 2022 · 6 comments

Comments

@phayes
Copy link

phayes commented Aug 20, 2022

Hi there,

I was wondering if there are any plans to support diesel 2? I would be willing to pay for this development if required.

@ThouCheese
Copy link
Owner

Hey, thanks for the offer. I am willing to do this for free since I need it myself too, so I whipped up a branch that you can use until Diesel 2.0 comes out: feat/diesel-2.0. Let me know if you run into anything :)

@phayes
Copy link
Author

phayes commented Oct 24, 2022

Hey @ThouCheese ,

So far so good. One issue I'm running into on this is supporting the new #[diesel(sql_type = SomeType)]type annotation instead of the deprecated #[sql_type = "SomeType"] notation

@ThouCheese
Copy link
Owner

Hey there @phayes, sorry about dropping off the radar for a little there. I've pushed another change that modifies the attributes to look like this:

#[derive(Debug, Clone, Copy, PartialEq, Eq, diesel::deserialize::FromSqlRow, DbEnum)]
#[diesel(sql_type = SmallInt)]
#[diesel_enum(error_fn = CustomError::not_found)]
#[diesel_enum(error_type = CustomError)]
pub enum Status {
    /// Will be represented as 0.
    Ready,
    /// Will be represented as 1.
    Pending,
}

I'm no master of proc macros, so it doesn't produce the best error messages, but let me know what you think!

@zdannar
Copy link

zdannar commented Mar 17, 2023

@ThouCheese,

I just updated to the branch, things are compiling. I will be able to report back in the near future if things are working correctly.

@peschkaj
Copy link

With Diesel now at 2.1.0, what are the odds of getting this merged into the current crate?

@ThouCheese
Copy link
Owner

ThouCheese commented Jan 2, 2024

@zdannar @peschkaj @phayes Support for diesel 2.0 is now on master and on crates.io! Find it at version 0.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants