Crates.io | pinto |
lib.rs | pinto |
version | 0.6.1 |
source | src |
created_at | 2017-06-06 01:57:28.30288 |
updated_at | 2017-11-08 01:47:54.676262 |
description | SQL query builder |
homepage | |
repository | https://github.com/jacobbudin/pinto |
max_upload_size | |
id | 17893 |
size | 23,790 |
Pinto is a small, easy-to-use library for constructing SQL queries programmatically in Rust.
⚠️ This library does not provide query parameterization. Do not use raw user-supplied data in your queries. If inputs are not properly escaped, your software will be suspectible to SQL injection attacks.
The library aims to generate queries compatible with PostgreSQL, MySQL, and SQLite.
Add pinto
as a dependency:
[dependencies]
pinto = "0.6.1"
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.
DELETE
WHERE
clauseINSERT
SELECT
AS
)JOIN
clauseWHERE
clauseGROUP BY
clauseHAVING
clauseORDER BY
clauseLIMIT
and OFFSET
clauseUPDATE
WHERE
clausePinto aims to be:
Other design goals, such as performance, are relevant but not foremost.
MIT