Add reader.v5.tasks.Task.created_at.
There was no way to "quickly" get the creation date.
@@ -147,6 +147,38 @@ impl Task {
_ => None,
}
}
+
+ pub fn created_at(&self) -> Option<OffsetDateTime> {
+ match &self.content {
+ TaskContent::IndexCreation { index_uid: _, primary_key: _ } => {
+ match self.events.first() {
+ Some(TaskEvent::Created(ts)) => Some(*ts),
+ _ => None,
+ }
+ }
+ TaskContent::DocumentAddition {
+ index_uid: _,
+ content_uuid: _,
+ merge_strategy: _,
+ primary_key: _,
+ documents_count: _,
+ allow_index_creation: _,
+ } => match self.events.first() {
+ Some(TaskEvent::Created(ts)) => Some(*ts),
+ _ => None,
+ },
+ TaskContent::SettingsUpdate {
+ index_uid: _,
+ settings: _,
+ is_deletion: _,
+ allow_index_creation: _,
+ } => match self.events.first() {
+ Some(TaskEvent::Created(ts)) => Some(*ts),
+ _ => None,
+ },
+ _ => None,
+ }
+ }
}
impl IndexUid {
