2 releases

0.3.1 Apr 15, 2020
0.3.0 Apr 15, 2020

#244 in #sql-query

MIT license

10KB
188 lines

rsyesql

crates.io docs.rs ci

Inspired by Yesql, see rational section there for more info.

Usage

queries.sql:

-- name: select
SELECT * FROM users;

-- name: delete
DELETE FROM users WHERE id = $1;

In Rust code:

let queries = rsyesql::parse(include_str!("./queries.sql"));
println!("{}", queries.get("select").unwrap()); // SELECT * FROM users;
println!("{}", queries.get("delete").unwrap()); // DELETE FROM users WHERE id = $1;

LICENSE MIT


lib.rs:

Parse SQL queries as text to [IndexMap] (tag => query).

Inspired by github.com/krisajenkins/yesql. This is Rust port with additional features.

Dependencies

~3–4MB
~71K SLoC