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 7
7
//! ## Usage
8
8
//!
9
9
//! Simple example:
10
- //! ```ignore
10
+ //! ```
11
11
//! use postgrest::Postgrest;
12
12
//!
13
+ //! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
13
14
//! let client = Postgrest::new("https://your-postgrest-endpoint");
14
15
//! let resp = client
15
16
//! .from("your_table")
19
20
//! let body = resp
20
21
//! .text()
21
22
//! .await?;
23
+ //! # Ok(())
24
+ //! # }
22
25
//! ```
23
26
//!
24
27
//! 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");
26
32
//! let resp = client
27
33
//! .from("your_table")
28
34
//! .eq("country", "Germany")
29
35
//! .gte("id", "20")
30
36
//! .select("*")
31
37
//! .execute()
32
38
//! .await?;
39
+ //! # Ok(())
40
+ //! # }
33
41
//! ```
34
42
//!
35
43
//! 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");
37
48
//! let resp = client
38
49
//! .from("your_table")
39
50
//! .eq("username", "soedirgo")
40
51
//! .update("{\"organization\": \"supabase\"}")
41
52
//! .execute()
42
53
//! .await?;
54
+ //! # Ok(())
55
+ //! # }
43
56
//! ```
44
57
//!
45
58
//! 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");
47
63
//! let resp = client
48
64
//! .rpc("add", "{\"a\": 1, \"b\": 2}")
49
65
//! .execute()
50
66
//! .await?;
67
+ //! # Ok(())
68
+ //! # }
51
69
//! ```
52
70
//!
53
71
//! 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