pub enum InsertValues {
Single(HashMap<String, Value>),
Bulk(Vec<HashMap<String, Value>>),
}Expand description
Insert values - either a single row or multiple rows (bulk insert).
§Examples
use postgrest_parser::InsertValues;
use std::collections::HashMap;
use serde_json::json;
// Single row insert
let mut row = HashMap::new();
row.insert("name".to_string(), json!("Alice"));
let single = InsertValues::Single(row);
assert_eq!(single.len(), 1);
// Bulk insert
let mut row1 = HashMap::new();
row1.insert("name".to_string(), json!("Alice"));
let mut row2 = HashMap::new();
row2.insert("name".to_string(), json!("Bob"));
let bulk = InsertValues::Bulk(vec![row1, row2]);
assert_eq!(bulk.len(), 2);Variants§
Single(HashMap<String, Value>)
Single row insert
Bulk(Vec<HashMap<String, Value>>)
Bulk insert with multiple rows
Implementations§
Trait Implementations§
Source§impl Clone for InsertValues
impl Clone for InsertValues
Source§fn clone(&self) -> InsertValues
fn clone(&self) -> InsertValues
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InsertValues
impl Debug for InsertValues
Source§impl<'de> Deserialize<'de> for InsertValues
impl<'de> Deserialize<'de> for InsertValues
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for InsertValues
impl PartialEq for InsertValues
Source§impl Serialize for InsertValues
impl Serialize for InsertValues
impl StructuralPartialEq for InsertValues
Auto Trait Implementations§
impl Freeze for InsertValues
impl RefUnwindSafe for InsertValues
impl Send for InsertValues
impl Sync for InsertValues
impl Unpin for InsertValues
impl UnwindSafe for InsertValues
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more