-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Labels
enhancementNew feature or requestNew feature or request
Description
I have found these related issues/pull requests
none
Description
Since query! needs enums types to be overridden, compile time checks (for that column) are disabled.
Example:
#[sqlx(type_name = "task_type", rename_all = "SCREAMING_SNAKE_CASE")]
pub enum TaskKind {
SendMessage,
Wait,
SendMail,
Filter,
EditTag,
}
let test = query!(
r#"
SELECT exec_id, type as typee
FROM funnel_queue JOIN funnel_steps on funnel_queue.step_id = funnel_steps.step_id
LIMIT 1;
"#
)This throws a compile time error: rustc: unsupported type task_type of column #6 ("typee").
It must be solved with a as "typee: TaskKind".
Prefered solution
I read that it's difficult to fix this directly; my proposal is to still validate the enum at compile time to at least know that the type is correct. Since there's a type_name = "task_type" this should be possible.
Is this a breaking change? Why or why not?
Could make builds fail if someone has a mismatching enum.
jaskij, rakshith-ravi, duhby, biruburu and tosti007
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request