I'm getting a weird error I don't understand, and unfortunately can't debug properly since the issue is in the query_as macro during sqlx_prepare, so I can't see the macro expansion either.
I have a migration that roughly looks like this:
CREATE TABLE IF NOT EXISTS competencies
(
learner_id INTEGER NOT NULL REFERENCES learners(id),
concept_id INTEGER NOT NULL REFERENCES concepts(id),
remember DOUBLE PRECISION NOT NULL DEFAULT 0.0,
understand DOUBLE PRECISION NOT NULL DEFAULT 0.0,
apply DOUBLE PRECISION NOT NULL DEFAULT 0.0,
"analyse" DOUBLE PRECISION NOT NULL DEFAULT 0.0,
evaluate DOUBLE PRECISION NOT NULL DEFAULT 0.0,
"create" DOUBLE PRECISION NOT NULL DEFAULT 0.0,
PRIMARY KEY (learner_id, concept_id)
);
and a table row
#[derive(Clone, Debug, Default,sqlx_turso::sqlx::FromRow)]
pub struct Competency {
pub remember: f64,
pub understand: f64,
pub apply: f64,
pub analyse: f64,
pub evaluate: f64,
pub create: f64,
}
...but if I try to query it as such:
sqlx_turso::query_as!(
Competency,
r#"
SELECT c.remember, c.understand, c.apply, c."analyse", c.evaluate, c."create"
FROM competencies c
JOIN learners l ON l.id = c.learner_id
JOIN concepts k ON k.id = c.concept_id
WHERE l.identifier = ? AND k.identifier = ?
"#,
user_ident,
uri
)
...then running sqlx-turso prepare throws the trait bound f64: From<Option<f64>> is not satisfied somewhere in the macro invocation. Notably, it works with vanilla sqlx and sqlite. Any idea what I'm doing wrong or need to do differently?
I'm getting a weird error I don't understand, and unfortunately can't debug properly since the issue is in the
query_asmacro duringsqlx_prepare, so I can't see the macro expansion either.I have a migration that roughly looks like this:
and a table row
...but if I try to query it as such:
...then running
sqlx-turso preparethrowsthe trait bound f64: From<Option<f64>> is not satisfiedsomewhere in the macro invocation. Notably, it works with vanilla sqlx and sqlite. Any idea what I'm doing wrong or need to do differently?