What you did
I have a timestamp field in a toasty::Embed struct. I want to query the db and order by this timestamp in the embedded struct
What you expected
I expected the query to succeed.
What actually happened
the query resulted in a panic
thread 'tokio-rt-worker' (258214) panicked at /home/xxx/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/toasty-sql-0.10.0/src/serializer/expr.rs:244:18:
not yet implemented: expr=ExprCast {
expr: Column(
ExprColumn {
nesting: 0,
table: 0,
column: 2,
},
),
from: None,
ty: Timestamp,
}
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'main' (258050) panicked at /home/xxx/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/toasty-0.10.0/src/db/connection.rs:65:35:
called `Result::unwrap()` on an `Err` value: RecvError(())
Minimal reproducer
#[derive(toasty::Embed)]
struct EmbeddedData {
timestamp: jiff::Timestamp,
}
#[derive(toasty::Model)]
struct Data {
#[key]
id: u64,
timestamp: jiff::Timestamp,
embedded: EmbeddedData,
}
#[tokio::main]
async fn main() {
let mut db = toasty::Db::builder()
.models(toasty::models!(crate::*))
.connect("sqlite::memory:")
.await
.unwrap();
db.push_schema().await.unwrap();
Data::all()
.order_by(Data::fields().timestamp().asc())
.exec(&mut db)
.await
.unwrap();
println!("if you see this, querying by top-level timestamp works");
Data::all()
.order_by(Data::fields().embedded().timestamp().asc())
.exec(&mut db)
.await
.unwrap();
println!("if you see this, querying by embedded timestamp works");
}
Database driver
sqlite
Toasty version
0.10.0
Additional context
No response
What you did
I have a timestamp field in a
toasty::Embedstruct. I want to query the db and order by this timestamp in the embedded structWhat you expected
I expected the query to succeed.
What actually happened
the query resulted in a panic
Minimal reproducer
Database driver
sqlite
Toasty version
0.10.0
Additional context
No response