5 unstable releases
0.3.0 | Aug 30, 2020 |
---|---|
0.2.0 | Apr 29, 2020 |
0.1.2 | Apr 25, 2020 |
0.1.1 | Apr 24, 2020 |
0.1.0 | Apr 23, 2020 |
#74 in #query-builder
24KB
557 lines
Postgres QueryBuilder
postgres-querybuilder
is a tool to help you write dynamic sql queries in rust and make them work with rust-postgres.
Example
let client = pool.get().await?;
let mut builder = SelectBuilder::new("users");
builder.select("id");
builder.select("email");
builder.where_eq("password", "123456".to_string());
let query = builder.get_query();
let params = builder.get_ref_params();
let stmt = client.prepare(query.as_str()).await?;
let rows = client.query(&stmt, ¶ms).await?;
let user = rows.first().map(User::from);
TODO
- Select query
- choose columns
- where equal
- where not equal
- or where condition
- group by
- limit
- offset
- order by
-
WITH
query
- Update query
- set value
- where equal
- where not equal
- or where condition
- returning
-
WITH
query
- Insert query
- Delete query
- from subrequest
Dependencies
~5MB
~111K SLoC