Skip to main content

cortex/
reports.rs

1//! Virtual tables/ORM for reports produced by the `CorTeX` backend
2
3#![allow(missing_docs, unused_imports)]
4table! {
5  /// Table declaration for the return type for aggregate report queries
6  aggregate_reports (report_name) {
7    report_name -> Nullable<Text>,
8    task_count -> BigInt,
9    message_count -> BigInt,
10  }
11}
12
13#[derive(Debug, Clone, Default, PartialEq, Eq, QueryableByName)]
14#[diesel(table_name = aggregate_reports)]
15/// The return struct of aggregate reports targeting task and log message counts. `Default` is the
16/// zero report (no name, zero tasks/messages) — the graceful degradation a report grain falls back
17/// to when its aggregate query errors, instead of panicking the request (see `backend::reports`).
18pub struct AggregateReport {
19  /// the category, per `LaTeXML` convention
20  pub report_name: Option<String>,
21  /// number of tasks with messages under this category (in implied severity - strictly)
22  pub task_count: i64,
23  /// number of messages under this category (in implied severity - strictly)
24  pub message_count: i64,
25}
26
27table! {
28  /// Table declaration of the return type for "task details" report queries
29  task_detail_reports (id) {
30    id -> BigInt,
31    entry -> Text,
32    details -> Text,
33  }
34}
35
36#[derive(Debug, Clone, PartialEq, Eq, QueryableByName)]
37#[diesel(table_name = task_detail_reports)]
38/// The return struct of "task details" reports
39pub struct TaskDetailReport {
40  /// the task id
41  pub id: i64,
42  /// the task entry path
43  pub entry: String,
44  /// the details for the queried log (severity, category,what) selection
45  pub details: String,
46}