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

DeriveValueType relies on a QueryResult import #1855

Closed
nitnelave opened this issue Sep 11, 2023 · 2 comments
Closed

DeriveValueType relies on a QueryResult import #1855

nitnelave opened this issue Sep 11, 2023 · 2 comments

Comments

@nitnelave
Copy link

Description

When using #[derive(DeriveValueType)], the generated code refers to a naked QueryType, which breaks if it's not imported.

Steps to Reproduce

use sea_orm::DeriveValueType;

#[derive(DeriveValueType)]
struct MyStruct;

Expected Behavior

Compiles

Actual Behavior

cannot find type QueryResult in this scope

Workarounds

use sea_orm::QueryResult;

Versions

12.0 (DeriveValueType was introduced in 12.0)

@tyt2y3
Copy link
Member

tyt2y3 commented Sep 12, 2023

Thanks for the report! I think we should patch this

@github-actions
Copy link

🎉 Released In 0.12.3 🎉

Thank you everyone for the contribution!
This feature is now available in the latest release. Now is a good time to upgrade!
Your participation is what makes us unique; your adoption is what drives us forward.
You can support SeaQL 🌊 by starring our repos, sharing our libraries and becoming a sponsor ⭐.

@tyt2y3 tyt2y3 closed this as completed Sep 26, 2023
bobogei81123 added a commit to bobogei81123/sea-orm that referenced this issue Jan 5, 2024
`DeriveValueType` proc macro relies on several sea-orm types to be
imported. This is partially fixed in SeaQL#1855 by fully qualifying
`sea_orm::QueryResult`, but others like `sea_orm::Value` is still not
being qualified. Also, if use defined a type alias on
`std::result::Result`, it can cause the proc macro to generate code that
won't compile.

- Fully qualify `sea_orm::Value`, `std::string::String`, and
  `std::result::Result` in `DeriveValueType` proc macro.
- Add some simple integration tests for this.
- Add doc and doc test in `sea_orm_macro::derive_value_type`.
tyt2y3 pushed a commit that referenced this issue Jan 14, 2024
`DeriveValueType` proc macro relies on several sea-orm types to be
imported. This is partially fixed in #1855 by fully qualifying
`sea_orm::QueryResult`, but others like `sea_orm::Value` is still not
being qualified. Also, if use defined a type alias on
`std::result::Result`, it can cause the proc macro to generate code that
won't compile.

- Fully qualify `sea_orm::Value`, `std::string::String`, and
  `std::result::Result` in `DeriveValueType` proc macro.
- Add some simple integration tests for this.
- Add doc and doc test in `sea_orm_macro::derive_value_type`.
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

2 participants