A safe, extensible ORM and Query Builder for Rust – For feature requests and longer questions also see https://github.com/diesel-rs/diesel/discussions/categories/q-a
I think maybe for something like this rather that relying on a full blown query hierarchy it be better to just add a derive that builds a players::table.select((players.uid, players.name)) that the end user could simply just use the rest of regular diesel along with it
I have actually finished implementing support for the above in my ORM lib (on top of diesel) using rust macros. I am currently working on solving this issue for INSERT
and UPDATE
. And then will move on to associations
(I have a vague idea on how to solve the n+1 problem)
[u8; 8]
in a derive Queryable struct but not a derive Insertable struct (you get an error about it not implementing Expression for the latter). I've worked around it with a serialize_as wrapper for now. Should I file a github issue or is there an underlying cause here I haven't thought about?
#[macro_use]
extern crate diesel;
table! {
examples (id) {
id -> Int4,
bytes -> Bytea,
}
}
// Compiles
#[derive(Queryable)]
struct Example {
id: i32,
bytes: [u8; 8],
}
// Doesn't compile
#[derive(Insertable)]
#[table_name = "examples"]
struct NewExample {
bytes: [u8; 8],
}
for now, my code looks like:
table
.filter(available.eq(query.available()))
.limit(query.limit())
.offset(query.offset());
diesel is AWESOME~~~
@tzsword I have actually been looking into this issue last week. The issue is that diesel uses some derive macros inside it non proc macros which is why re-exporting doesn't work. I am planning to solve it soon.
Awesomeeeeeeeeeeeeee this is very cool, can I help? I'm a rookie~~
$crate::query_builder::QueryId
by adding the derived code locally