Crates.io | into_query |
lib.rs | into_query |
version | 0.2.4 |
source | src |
created_at | 2020-12-03 13:55:40.247054 |
updated_at | 2022-04-02 14:03:02.544867 |
description | Convert option structs into filters for use with diesel |
homepage | |
repository | https://github.com/charliethomson/into_query/tree/master/into_query |
max_upload_size | |
id | 319281 |
size | 3,394 |
#[derive(IntoQuery)]
#[table_name = "whateverlol"]
pub struct Filter {
foo: Option<String>,
bar: Option<Vec<i32>>,
baz: Option<Vec<u8>>,
}
mysql
, postgres
, sqlite
: Set the backend to be used by the query builder
(default: mysql
)
table_name
: required
schema::<this>::dsl::<this>
schema_prefix
: optional (default: crate
)
<this>::schema::<table_name>::dsl
For example, if your project was structured as
src
│ main.rs
└───db
└───schema.rs
and your table was "cats"
#[derive(IntoQuery)]
#[table_name = "cats"]
#[schema_prefix = "crate::db"]
struct CatOptions {
..
}