pub struct Insert<T: DynTable, S, B> { /* private fields */ }Expand description
Builder for an insert operation.
Implementations§
Source§impl<T: SchemaWithPK, S: Clone, B: Clone> Insert<T, S, B>
impl<T: SchemaWithPK, S: Clone, B: Clone> Insert<T, S, B>
Sourcepub fn extract_pk(&self) -> Vec<Value<S, B>>
pub fn extract_pk(&self) -> Vec<Value<S, B>>
Extract the primary key values from this insert’s values.
Source§impl<T: DynTable, S: AsRef<str>, B: AsRef<[u8]>> Insert<T, S, B>
impl<T: DynTable, S: AsRef<str>, B: AsRef<[u8]>> Insert<T, S, B>
Sourcepub fn set_null(self, col_idx: usize) -> Result<Self, Error>
pub fn set_null(self, col_idx: usize) -> Result<Self, Error>
Sets a column to NULL.
This is a convenience method equivalent to .set(col_idx, Value::Null).
§Errors
ColumnIndexOutOfBounds- If the provided column index is out of bounds for the table schema.
§Example
use sqlite_diff_rs::{Insert, TableSchema};
// CREATE TABLE items (id INTEGER PRIMARY KEY, description TEXT, price REAL)
let schema: TableSchema<String> = TableSchema::new("items".into(), 3, vec![1, 0, 0]);
// INSERT INTO items (id, description, price) VALUES (1, NULL, 9.99)
let insert = Insert::<_, String, Vec<u8>>::from(schema)
.set(0, 1i64).unwrap()
.set_null(1).unwrap() // description = NULL
.set(2, 9.99f64).unwrap();Trait Implementations§
impl<T: DynTable + Eq, S: Eq + AsRef<str>, B: Eq + AsRef<[u8]>> Eq for Insert<T, S, B>
Auto Trait Implementations§
impl<T, S, B> Freeze for Insert<T, S, B>where
T: Freeze,
impl<T, S, B> RefUnwindSafe for Insert<T, S, B>
impl<T, S, B> Send for Insert<T, S, B>
impl<T, S, B> Sync for Insert<T, S, B>
impl<T, S, B> Unpin for Insert<T, S, B>
impl<T, S, B> UnsafeUnpin for Insert<T, S, B>where
T: UnsafeUnpin,
impl<T, S, B> UnwindSafe for Insert<T, S, B>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.