use super::{ColumnType, TableRef};
use serde::{Deserialize, Serialize};
use sqlparser::ast::Ident;
#[derive(Debug, PartialEq, Eq, Clone, Hash, Serialize, Deserialize)]
pub struct ColumnRef {
column_id: Ident,
table_ref: TableRef,
column_type: ColumnType,
}
impl ColumnRef {
#[must_use]
pub fn new(table_ref: TableRef, column_id: Ident, column_type: ColumnType) -> Self {
Self {
column_id,
table_ref,
column_type,
}
}
#[must_use]
pub fn table_ref(&self) -> TableRef {
self.table_ref.clone()
}
#[must_use]
pub fn column_id(&self) -> Ident {
self.column_id.clone()
}
#[must_use]
pub fn column_type(&self) -> &ColumnType {
&self.column_type
}
}