pinto 0.3.0

SQL query builder
Documentation

Pinto

Pinto is a small, easy-to-use library for constructing SQL queries programmatically in Rust.

Databases

The library aims to generate queries compatible with PostgreSQL, MySQL, and SQLite.

Install

Add pinto as a dependency:

[dependencies]
pinto = "0.3"

Example

let query = query_builder::select("users")
    .fields(&["id", "name"])
    .filter("name = $1")
    .order_by("id", query_builder::Order::Asc)
    .build();
assert_eq!("SELECT id, name FROM users WHERE name = $1 ORDER BY id ASC;", query);

See included tests for additional examples.

Features

Statements

  • DELETE
    • WHERE clause
  • INSERT
  • SELECT
    • Table alias (AS)
    • Field selection
    • WHERE clause
    • ORDER BY clause
    • LIMIT and OFFSET clause
  • UPDATE
    • WHERE clause

Roadmap

  • SELECT
    • Table joins

License

MIT