[][src]Crate postgrest

postgrest-rs

PostgREST client-side library.

This library brings an ORM-like interface to PostgREST.

Usage

Simple example:

This example is not tested
use postgrest::Postgrest;

let client = Postgrest::new("https://your-postgrest-endpoint");
let resp = client
    .from("your_table")
    .select("*")
    .execute()
    .await?;
let body = resp
    .text()
    .await?;

Using filters:

This example is not tested
let resp = client
    .from("your_table")
    .eq("country", "Germany")
    .gte("id", "20")
    .select("*")
    .execute()
    .await?;

Updating a table:

This example is not tested
let resp = client
    .from("your_table")
    .eq("username", "soedirgo")
    .update("{\"organization\": \"supabase\"}")
    .execute()
    .await?;

Executing stored procedures:

This example is not tested
let resp = client
    .rpc("add", "{\"a\": 1, \"b\": 2}")
    .execute()
    .await?;

Check out the README for more examples.

Structs

Postgrest