postgres-querybuilder

Crates.iopostgres-querybuilder
lib.rspostgres-querybuilder
version0.3.0
sourcesrc
created_at2020-04-23 11:22:27.247479
updated_at2020-08-30 08:34:25.169969
descriptionA simple tool to help you build your postgres queries easily
homepage
repositoryhttps://github.com/jdrouet/postgres-querybuilder/
max_upload_size
id233253
size24,560
Jérémie Drouet (jdrouet)

documentation

README

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, &params).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
Commit count: 25

cargo fmt