File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 77//! ## Usage
88//!
99//! Simple example:
10- //! ```ignore
10+ //! ```
1111//! use postgrest::Postgrest;
1212//!
13+ //! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
1314//! let client = Postgrest::new("https://your-postgrest-endpoint");
1415//! let resp = client
1516//! .from("your_table")
1920//! let body = resp
2021//! .text()
2122//! .await?;
23+ //! # Ok(())
24+ //! # }
2225//! ```
2326//!
2427//! Using filters:
25- //! ```ignore
28+ //! ```
29+ //! # use postgrest::Postgrest;
30+ //! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
31+ //! # let client = Postgrest::new("https://your-postgrest-endpoint");
2632//! let resp = client
2733//! .from("your_table")
2834//! .eq("country", "Germany")
2935//! .gte("id", "20")
3036//! .select("*")
3137//! .execute()
3238//! .await?;
39+ //! # Ok(())
40+ //! # }
3341//! ```
3442//!
3543//! Updating a table:
36- //! ```ignore
44+ //! ```
45+ //! # use postgrest::Postgrest;
46+ //! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
47+ //! # let client = Postgrest::new("https://your-postgrest-endpoint");
3748//! let resp = client
3849//! .from("your_table")
3950//! .eq("username", "soedirgo")
4051//! .update("{\"organization\": \"supabase\"}")
4152//! .execute()
4253//! .await?;
54+ //! # Ok(())
55+ //! # }
4356//! ```
4457//!
4558//! Executing stored procedures:
46- //! ```ignore
59+ //! ```
60+ //! # use postgrest::Postgrest;
61+ //! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
62+ //! # let client = Postgrest::new("https://your-postgrest-endpoint");
4763//! let resp = client
4864//! .rpc("add", "{\"a\": 1, \"b\": 2}")
4965//! .execute()
5066//! .await?;
67+ //! # Ok(())
68+ //! # }
5169//! ```
5270//!
5371//! Check out the [README](https://github.com/supabase/postgrest-rs) for more examples.
You can’t perform that action at this time.
0 commit comments