Skip to main content

ora_backend/
common.rs

1//! Common types and utilities.
2
3use std::time::SystemTime;
4
5use serde::{Deserialize, Serialize};
6
7/// A label associated with an entity.
8#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
9pub struct Label {
10    /// The key of the label.
11    pub key: String,
12    /// The value of the label.
13    pub value: String,
14}
15
16/// A filter for labels.
17#[derive(Debug, Clone, Serialize, Deserialize)]
18pub struct LabelFilter {
19    /// The key of the label to filter by.
20    pub key: String,
21    /// An optional value of the label to filter by,
22    /// if not specified, entities with
23    /// the given key and any value will match.
24    pub value: Option<String>,
25}
26
27/// An exclusive time range that can be open-ended on either side.
28#[derive(Debug, Default, Clone, Serialize, Deserialize)]
29pub struct TimeRange {
30    /// The start of the time range.
31    ///
32    /// If `None`, the range is open-ended at the start.
33    pub start: Option<SystemTime>,
34    /// The end of the time range.
35    ///
36    /// If `None`, the range is open-ended at the end.
37    pub end: Option<SystemTime>,
38}
39
40/// A token for fetching the next page of results.
41///
42/// The content and format of the token is backend-specific.
43#[derive(Clone, Debug, PartialEq, Eq, Hash)]
44#[repr(transparent)]
45pub struct NextPageToken(pub String);