diff options
author | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-06 08:02:10 -0500 |
---|---|---|
committer | Kjetil Orbekk <kjetil.orbekk@gmail.com> | 2020-02-06 08:02:10 -0500 |
commit | e28984768b161af34b3ab1eec9ff53fd8b19e253 (patch) | |
tree | 678ec34b954428c807c2b16b3f2d6a5f9a856d2b | |
parent | 771de742576ca128604246a1252d5d126330abb0 (diff) |
Add some definitions for display templates
-rw-r--r-- | src/error.rs | 1 | ||||
-rw-r--r-- | src/models.rs | 26 |
2 files changed, 26 insertions, 1 deletions
diff --git a/src/error.rs b/src/error.rs index 22ff600..166005d 100644 --- a/src/error.rs +++ b/src/error.rs @@ -1,5 +1,4 @@ use bcrypt::BcryptError; -use chrono::format::ParseResult; use diesel::result::Error as DieselErr; use serde_json::Value; use std::convert::From; diff --git a/src/models.rs b/src/models.rs index 83153fd..624a1ce 100644 --- a/src/models.rs +++ b/src/models.rs @@ -170,3 +170,29 @@ pub struct Entry { pub timestamp: Option<DateTime<Utc>>, pub payload: Value, } + +#[derive(Debug, Serialize, Deserialize, Clone)] +pub enum Unit { + TimestampRfc3339, + Meters, + Seconds, + Unknown, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct Column { + field: String, + display_name: Option<String>, + unit: Unit, +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +pub enum TemplateSpec { + Table(Vec<Column>), +} + +#[derive(Debug, Serialize, Deserialize, Clone)] +pub struct Template { + pub entry_type: String, + pub spec: TemplateSpec, +} |