pleingres-sql-plugin-0.2.0 doesn't have any documentation.
This plugin allows to generate simple SQL queries from Rust
struct. More specifically, it generates implementations of the
pleingres::Request
trait, replacing named variables (such as
$field
, which is invalid SQL) in the query by $1
in the query,
and calling pleingres::Buffer.bind
on self.field
.
It only works if the fields used in the query implement
pleingres::ToSql
, and if the type is a struct.
Example:
#![feature(plugin)]
#![plugin(sql)]
#[sql("SELECT id, is_active FROM users WHERE login = $user")]
pub struct UserReq {
pub user: String,
pub is_active: bool,
pub id: Option<Uuid>
}