Crates.io | postgres-querybuilder |
lib.rs | postgres-querybuilder |
version | 0.3.0 |
source | src |
created_at | 2020-04-23 11:22:27.247479 |
updated_at | 2020-08-30 08:34:25.169969 |
description | A simple tool to help you build your postgres queries easily |
homepage | |
repository | https://github.com/jdrouet/postgres-querybuilder/ |
max_upload_size | |
id | 233253 |
size | 24,560 |
postgres-querybuilder
is a tool to help you write dynamic sql queries in rust and make them work with rust-postgres.
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);
WITH
queryWITH
query