json_eval_rs/
table_metadata.rs1use serde_json::Value;
2use std::sync::Arc;
3use crate::LogicId;
4
5#[derive(Clone, Debug)]
7pub struct ColumnMetadata {
8 pub name: Arc<str>,
10 pub var_path: Arc<str>,
12 pub logic: Option<LogicId>,
14 pub literal: Option<Arc<Value>>,
16 pub dependencies: Arc<[String]>,
18 pub has_forward_ref: bool,
20}
21
22impl ColumnMetadata {
23 #[inline]
24 pub fn new(
25 name: &str,
26 logic: Option<LogicId>,
27 literal: Option<Value>,
28 dependencies: Vec<String>,
29 has_forward_ref: bool,
30 ) -> Self {
31 let var_path = format!("${}", name);
32 Self {
33 name: Arc::from(name),
34 var_path: Arc::from(var_path.as_str()),
35 logic,
36 literal: literal.map(Arc::new),
37 dependencies: dependencies.into(),
38 has_forward_ref,
39 }
40 }
41}
42
43#[derive(Clone, Debug)]
45pub struct RepeatBoundMetadata {
46 pub logic: Option<LogicId>,
47 pub literal: Arc<Value>,
49}
50
51#[derive(Clone, Debug)]
53pub enum RowMetadata {
54 Static {
55 columns: Arc<[ColumnMetadata]>,
56 },
57 Repeat {
58 start: RepeatBoundMetadata,
59 end: RepeatBoundMetadata,
60 columns: Arc<[ColumnMetadata]>,
61 forward_cols: Arc<[usize]>, normal_cols: Arc<[usize]>, },
66}
67
68#[derive(Clone, Debug)]
70pub struct TableMetadata {
71 pub data_plans: Arc<[(Arc<str>, Option<LogicId>, Option<Arc<Value>>)]>,
73 pub row_plans: Arc<[RowMetadata]>,
75 pub skip_logic: Option<LogicId>,
77 pub skip_literal: bool,
79 pub clear_logic: Option<LogicId>,
81 pub clear_literal: bool,
83}