Trait pace_core::ActivityWriteOps
source · pub trait ActivityWriteOps: ActivityReadOps {
// Required methods
fn create_activity(&self, activity: Activity) -> PaceResult<ActivityGuid>;
fn update_activity(
&self,
activity_id: ActivityGuid,
activity: Activity
) -> PaceResult<Activity>;
fn delete_activity(&self, activity_id: ActivityGuid) -> PaceResult<Activity>;
}Expand description
Basic CUD Operations for Activities in the storage backend.
CUD stands for Create, Update, and Delete. These are the basic operations that can be performed on activities. These operations are essential for managing activities in the storage backend.
Required Methods§
sourcefn create_activity(&self, activity: Activity) -> PaceResult<ActivityGuid>
fn create_activity(&self, activity: Activity) -> PaceResult<ActivityGuid>
sourcefn update_activity(
&self,
activity_id: ActivityGuid,
activity: Activity
) -> PaceResult<Activity>
fn update_activity( &self, activity_id: ActivityGuid, activity: Activity ) -> PaceResult<Activity>
Update an existing activity in the storage backend.
§Note
This function should not be used to update the state of an activity (e.g., start, end, hold, resume) directly.
Use the ActivityStateManagement trait for that. This function is only for updating (as in replacing) the complete
data of an activity.
Warning: It can’t be used to update the ID of an activity, because that’s the primary key. So it is immutable.
§Arguments
activity_id- The ID of the activity to update.activity- The updated activity data.
§Errors
This function should return an error if the activity cannot be updated.
§Returns
If the activity was updated successfully it should return the activity before it was updated.