reifydb_client/domain/frame/
column.rs

1// Copyright (c) reifydb.com 2025
2// This file is licensed under the MIT, see license.md file
3
4use std::ops::Deref;
5
6use serde::{Deserialize, Serialize};
7
8use crate::{Type, Value};
9
10#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
11pub struct FrameColumn {
12	pub namespace: Option<String>,
13	pub store: Option<String>,
14	pub name: String,
15	pub r#type: Type,
16	pub data: Vec<Value>,
17}
18
19impl Deref for FrameColumn {
20	type Target = Vec<Value>;
21
22	fn deref(&self) -> &Self::Target {
23		&self.data
24	}
25}
26
27impl FrameColumn {
28	pub fn qualified_name(&self) -> String {
29		match (&self.namespace, &self.store) {
30			(Some(namespace), Some(table)) => {
31				format!("{}.{}.{}", namespace, table, self.name)
32			}
33			(None, Some(table)) => {
34				format!("{}.{}", table, self.name)
35			}
36			_ => self.name.clone(),
37		}
38	}
39}