pub trait ActivityQuerying: ActivityReadOps {
    // Required methods
    fn find_activities_in_date_range(
        &self,
        start_date: NaiveDate,
        end_date: NaiveDate
    ) -> PaceResult<ActivityLog>;
    fn list_activities_by_id(
        &self
    ) -> PaceOptResult<BTreeMap<ActivityGuid, Activity>>;
    fn latest_active_activity(&self) -> PaceOptResult<Activity>;

    // Provided method
    fn list_current_activities(&self) -> PaceOptResult<ActivityLog> { ... }
}
Expand description

Querying Activities

Querying activities is a way to get information about them from the storage backend. This is useful for getting a list of activities, finding activities within a specific date range, or getting activities by their ID.

For example, you might want to list all activities that are currently active, find all activities within a specific date range, or get a specific activity by its ID.

Required Methods§

source

fn find_activities_in_date_range( &self, start_date: NaiveDate, end_date: NaiveDate ) -> PaceResult<ActivityLog>

Find activities within a specific date range.

§Arguments
  • start_date - The start date of the range.
  • end_date - The end date of the range.
§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that fall within the specified date range.

source

fn list_activities_by_id( &self ) -> PaceOptResult<BTreeMap<ActivityGuid, Activity>>

Get all activities by their ID.

§Errors

This function should return an error if the activities cannot be loaded.

§Returns

A collection of the activities that were loaded from the storage backend by their ID in a BTreeMap. If no activities are found, it should return Ok(None).

source

fn latest_active_activity(&self) -> PaceOptResult<Activity>

Get the latest active activity.

§Errors

This function should return an error if the activity cannot be loaded.

§Returns

The latest active activity. If no activity is found, it should return Ok(None).

Provided Methods§

source

fn list_current_activities(&self) -> PaceOptResult<ActivityLog>

List all currently active activities from the storage backend.

§Errors

This function should return an error if the activities cannot be loaded. In case of no activities, it should return Ok(None).

§Returns

A collection of the activities that are currently active.

Implementors§