into_query

Crates.iointo_query
lib.rsinto_query
version0.2.4
sourcesrc
created_at2020-12-03 13:55:40.247054
updated_at2022-04-02 14:03:02.544867
descriptionConvert option structs into filters for use with diesel
homepage
repositoryhttps://github.com/charliethomson/into_query/tree/master/into_query
max_upload_size
id319281
size3,394
Charlie Thomson (charliethomson)

documentation

https://docs.rs/into_query/0.1.0/into_query/

README

into_query

Usage

#[derive(IntoQuery)]
#[table_name = "whateverlol"]
pub struct Filter {
    foo: Option<String>,
    bar: Option<Vec<i32>>,
    baz: Option<Vec<u8>>,
}

Features

mysql, postgres, sqlite: Set the backend to be used by the query builder (default: mysql)

Attributes

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 {
    ..
}
Commit count: 0

cargo fmt