pub enum ChangesetOp<'a, T, S, B> {
Insert {
table: &'a T,
values: &'a [Value<S, B>],
indirect: bool,
},
Update {
table: &'a T,
values: &'a [ChangesetUpdatePair<S, B>],
indirect: bool,
},
Delete {
table: &'a T,
old_values: &'a [Value<S, B>],
indirect: bool,
},
}Expand description
View over one operation in a changeset.
Variants§
Insert
INSERT. Carries every column’s value in column order.
Fields
Update
UPDATE. Carries (old, new) pairs per column. None in either
slot means “undefined” (the column was not part of the diff).
Fields
values: &'a [ChangesetUpdatePair<S, B>](old, new) pairs, one per column.
Delete
DELETE. Carries the full old-row values in column order.
Implementations§
Source§impl<'a, T, S, B> ChangesetOp<'a, T, S, B>
impl<'a, T, S, B> ChangesetOp<'a, T, S, B>
Source§impl<T, S, B> ChangesetOp<'_, T, S, B>
impl<T, S, B> ChangesetOp<'_, T, S, B>
Sourcepub fn changed_column_indices(&self) -> impl Iterator<Item = usize>
pub fn changed_column_indices(&self) -> impl Iterator<Item = usize>
Returns the indices of the columns whose pairs are
ChangesetUpdatePairExt::is_changed, and nothing for a non-UPDATE.
Source§impl<T: SchemaWithPK, S: Clone, B: Clone> ChangesetOp<'_, T, S, B>
impl<T: SchemaWithPK, S: Clone, B: Clone> ChangesetOp<'_, T, S, B>
Sourcepub fn primary_key(&self) -> Vec<Value<S, B>>
pub fn primary_key(&self) -> Vec<Value<S, B>>
Returns the primary-key cells of this operation, in key order.
Insert and Delete read the key from the full row via
SchemaWithPK::extract_pk. For Update each key cell is taken
old-first: a changeset UPDATE carries the key in the old slot as the
row identity, while the new slot is absent for a key column that did
not change, so reading the new slot (as extract_pk would over the
pair storage) can yield None.