Skip to content

DarrenBaldwin07/postgrest-query

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

postgrest-query

A type-safe query builder-esque experience for PostgREST

Install

cargo add postgrest-query

Usage

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 User {
    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::<User>().exec().await;
}

TODO

  • Simple Rust -> PostgREST -> Postgres leveraging serde and resembling the Prisma query builder
  • Support the entire PostgREST API
  • Potentially let consumers provide their own handler (defaults to reqwest for now)
  • Compile time query checks? (similar to sqlx)
  • Explore potential ports of this to other languages (TypeScript, Python, Go, etc.)

Issues and PRs are welcome!

About

A type-safe query builder-esque experience for PostgREST

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages