@@ -442,7 +442,7 @@ impl Builder {
442
442
/// let client = Postgrest::new("https://your.postgrest.endpoint");
443
443
/// client
444
444
/// .from("users")
445
- /// .insert(&my_serializable_struct)? ;
445
+ /// .insert(&my_serializable_struct).unwrap() ;
446
446
/// ```
447
447
#[ cfg( feature = "serde" ) ]
448
448
pub fn insert < T > ( self , body : & T ) -> serde_json:: Result < Self >
@@ -506,7 +506,7 @@ impl Builder {
506
506
/// let client = Postgrest::new("https://your.postgrest.endpoint");
507
507
/// client
508
508
/// .from("users")
509
- /// .upsert(&my_serializable_struct)? ;
509
+ /// .upsert(&my_serializable_struct).unwrap() ;
510
510
/// ```
511
511
#[ cfg( feature = "serde" ) ]
512
512
pub fn upsert < T > ( self , body : & T ) -> serde_json:: Result < Self >
@@ -543,11 +543,23 @@ impl Builder {
543
543
/// let client = Postgrest::new("https://your.postgrest.endpoint");
544
544
/// // Suppose `users` are keyed an SERIAL primary key,
545
545
/// // but have a unique index on `username`.
546
- /// client
547
- /// .from("users")
548
- /// .upsert(r#"[{ "username": "soedirgo", "status": "online" },
549
- /// { "username": "jose", "status": "offline" }]"#)
550
- /// .on_conflict("username");
546
+ #[ cfg_attr( not( feature = "serde" ) , doc = r##"
547
+ client
548
+ .from("users")
549
+ .upsert(r#"[{ "username": "soedirgo", "status": "online" },
550
+ { "username": "jose", "status": "offline" }]"#)
551
+ .on_conflict("username");
552
+ "## ) ]
553
+ #[ cfg_attr( feature = "serde" , doc = r##"
554
+ #[derive(serde::Serialize)]
555
+ struct MyStruct {}
556
+
557
+ let my_serializable_struct = MyStruct {};
558
+
559
+ client
560
+ .from("users")
561
+ .upsert(&my_serializable_struct).unwrap();
562
+ "## ) ]
551
563
/// ```
552
564
pub fn on_conflict < T > ( mut self , columns : T ) -> Self
553
565
where
@@ -595,7 +607,7 @@ impl Builder {
595
607
/// client
596
608
/// .from("users")
597
609
/// .eq("username", "soedirgo")
598
- /// .update(&my_serializable_struct)? ;
610
+ /// .update(&my_serializable_struct).unwrap() ;
599
611
/// ```
600
612
#[ cfg( feature = "serde" ) ]
601
613
pub fn update < T > ( self , body : & T ) -> serde_json:: Result < Self >
0 commit comments