#[derive(FromSqlRow)]
{
// Attributes available to this derive:
#[diesel]
}
Expand description
Implements Queryable
for types that correspond to a single SQL type. The type must implement FromSql
.
This derive is mostly useful to implement support deserializing into rust types not supported by Diesel itself.
There are no options or special considerations needed for this derive.
§Expanded Code
Expanded Code
§Input
ⓘ
#[derive(FromSqlRow)]
enum Foo {
Bar,
Baz,
}
§Expanded Code
Expanded code might use diesel internal API's and is only shown for educational purpose
The macro expands the input to the following Rust code:
ⓘ
const _: () = {
use diesel;
impl<__DB, __ST> diesel::deserialize::Queryable<__ST, __DB> for Foo
where
__DB: diesel::backend::Backend,
__ST: diesel::sql_types::SingleValue,
Self: diesel::deserialize::FromSql<__ST, __DB>,
{
type Row = Self;
fn build(row: Self) -> diesel::deserialize::Result<Self> {
Ok(row)
}
}
};