Crates.io | postgrest-query |
lib.rs | postgrest-query |
version | 0.1.0 |
source | src |
created_at | 2023-12-27 13:50:33.585889 |
updated_at | 2023-12-27 13:50:33.585889 |
description | A type-safe query builder-esque experience via PostgREST |
homepage | |
repository | |
max_upload_size | |
id | 1081671 |
size | 6,614 |
A type-safe query builder-esque experience via PostgREST
cargo add postgrest-query
use postgrest_query::PostgrestClient;
const URL: &str = "https://org-postgrest-query-demo-inst.data-1.use1.tembo.io/restapi/v1";
#[derive(serde::Serialize, serde::Deserialize)]
struct UserModel {
id: i32,
name: String,
password: String,
}
#[tokio::main]
async fn main() -> Result<(), std::error::Error> {
let db = PostgrestClient::new(URL);
let user_query = db.from("users").find_many::<UserModel>().exec().await;
}
Rust -> PostgREST -> Postgres
leveraging serde
and resembling the Prisma query buildersqlx
)