proof_of_sql/base/database/
column_ref.rs1use super::{ColumnType, TableRef};
2use serde::{Deserialize, Serialize};
3use sqlparser::ast::Ident;
4
5#[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)]
7pub struct ColumnRef {
8 column_id: Ident,
9 table_ref: TableRef,
10 column_type: ColumnType,
11}
12
13impl ColumnRef {
14 #[must_use]
16 pub fn new(table_ref: TableRef, column_id: Ident, column_type: ColumnType) -> Self {
17 Self {
18 column_id,
19 table_ref,
20 column_type,
21 }
22 }
23
24 #[must_use]
26 pub fn table_ref(&self) -> TableRef {
27 self.table_ref.clone()
28 }
29
30 #[must_use]
32 pub fn column_id(&self) -> Ident {
33 self.column_id.clone()
34 }
35
36 #[must_use]
38 pub fn column_type(&self) -> &ColumnType {
39 &self.column_type
40 }
41}