Skip to main content

gel_config/
types.rs

1use std::{collections::HashMap, time::Duration};
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6#[serde(untagged)]
7pub enum ConfigInput {
8    String(String),
9    Integer(i64),
10    Float(f64),
11    Boolean(bool),
12    DateTime(String),
13    Duration(Duration),
14    Date(String),
15    Time(String),
16    Array(Vec<ConfigInput>),
17    Object {
18        tname: String,
19        values: HashMap<String, ConfigInput>,
20    },
21    Null,
22}
23
24#[derive(Debug, Clone, Serialize, Deserialize)]
25pub enum ConfigSchemaType {
26    String,
27    Integer,
28    Float,
29    Boolean,
30    DateTime,
31    Duration,
32    Date,
33    Time,
34    Array(Box<ConfigSchemaType>),
35    Object(HashMap<String, ConfigSchemaType>),
36    Enum(Vec<ConfigObject>),
37}
38
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct ConfigObject {
41    pub name: String,
42    pub schema: HashMap<String, ConfigSchemaType>,
43}