1use std::collections::BTreeMap;
2
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
6pub struct ConfigData {
7 pub tables: Vec<TableData>,
8}
9
10#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
11pub struct TableData {
12 pub name: String,
13 pub rows: Vec<RowData>,
14}
15
16#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
17pub struct RowData {
18 pub values: BTreeMap<String, Value>,
19}
20
21#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
22pub enum Value {
23 Bool(bool),
24 Integer(i64),
25 Float(f64),
26 String(String),
27 List(Vec<Value>),
28 Object(BTreeMap<String, Value>),
29 Null,
30}
31
32impl Value {
33 pub(crate) fn kind_name(&self) -> &'static str {
34 match self {
35 Self::Bool(_) => "bool",
36 Self::Integer(_) => "integer",
37 Self::Float(_) => "float",
38 Self::String(_) => "string",
39 Self::List(_) => "list",
40 Self::Object(_) => "object",
41 Self::Null => "null",
42 }
43 }
44}