1use crate::{
2 attribute::AttributeList,
3 def_name_impls,
4 names::{ColumnIdent, TableIdent, ViewDefName, ViewKind},
5 uid::{next_uid, OwnUid, Uid},
6};
7
8#[derive(Debug)]
9pub enum DefinitionPart {
10 Raw(String),
11 TableRef(TableIdent),
12 ColumnRef(TableIdent, ColumnIdent),
13}
14#[derive(Debug)]
15pub struct Definition(pub Vec<DefinitionPart>);
16
17#[derive(Debug)]
18pub struct View {
19 uid: OwnUid,
20 name: ViewDefName,
21 pub docs: Vec<String>,
22 pub attrlist: AttributeList,
23 pub materialized: bool,
24 pub definition: Definition,
25}
26def_name_impls!(View, ViewKind);
27impl View {
28 pub fn new(
29 docs: Vec<String>,
30 attrlist: AttributeList,
31 name: ViewDefName,
32 materialized: bool,
33 definition: Definition,
34 ) -> Self {
35 Self {
36 uid: next_uid(),
37 name,
38 docs,
39 attrlist,
40 materialized,
41 definition,
42 }
43 }
44}