pub enum Operation {
Create {
uuid: Uuid,
},
Delete {
uuid: Uuid,
old_task: TaskMap,
},
Update {
uuid: Uuid,
property: String,
old_value: Option<String>,
value: Option<String>,
timestamp: DateTime<Utc>,
},
UndoPoint,
}Expand description
An Operation defines a single change to the task database, as stored locally in the replica.
Operations are the means by which changes are made to the database, typically batched together
into Operations and committed to the replica.
Variants§
Create
Create a new task.
On undo, the task is deleted.
Delete
Delete an existing task.
On undo, the task’s data is restored from old_task.
Update
Update an existing task, setting the given property to the given value. If the value is None, then the corresponding property is deleted.
On undo, the property is set back to its previous value.
Fields
UndoPoint
Mark a point in the operations history to which the user might like to undo. Users
typically want to undo more than one operation at a time (for example, most changes update
both the modified property and some other task property – the user would like to “undo”
both updates at the same time). Applying an UndoPoint does nothing.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Operation
impl<'de> Deserialize<'de> for Operation
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>,
Source§impl FromSql for Operation
Stores Operation in SQLite
impl FromSql for Operation
Stores Operation in SQLite
Source§fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>
fn column_result(value: ValueRef<'_>) -> FromSqlResult<Self>
Source§impl Ord for Operation
impl Ord for Operation
Source§fn cmp(&self, other: &Self) -> Ordering
fn cmp(&self, other: &Self) -> Ordering
Define an order for operations.
First, orders by Uuid, with all UndoPoints first. Then, by type, with Creates, then Updates, then Deletes. Updates are ordered by timestamp and, where that is equal, by the remaining fields. This ordering is intended to be “human-readable”, even in confusing situations like multiple creations of the same task.
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Operation
impl PartialOrd for Operation
Source§impl ToSql for Operation
Parses Operation stored as JSON in string column
impl ToSql for Operation
Parses Operation stored as JSON in string column
Source§fn to_sql(&self) -> Result<ToSqlOutput<'_>>
fn to_sql(&self) -> Result<ToSqlOutput<'_>>
impl Eq for Operation
impl StructuralPartialEq for Operation
Auto Trait Implementations§
impl Freeze for Operation
impl RefUnwindSafe for Operation
impl Send for Operation
impl Sync for Operation
impl Unpin for Operation
impl UnwindSafe for Operation
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more