dbml_rs/ast/table_group.rs
1use alloc::vec::Vec;
2
3use super::*;
4
5/// Represents a table group allowing to group the related or associated tables together.
6#[derive(Debug, Clone, Default)]
7pub struct TableGroupBlock {
8 /// The range of the span in the source text.
9 pub span_range: SpanRange,
10 /// The name of a table group
11 pub ident: Ident,
12 /// The note block associated with the table group block.
13 pub note: Option<NoteBlock>,
14 /// The list of table identifiers inside the group.
15 pub items: Vec<TableGroupItem>,
16
17 /// The settings for the table group.
18 pub settings: Option<TableGroupSettings>,
19}
20
21/// Represents settings of the table group.
22#[derive(Debug, Clone, Default)]
23pub struct TableGroupSettings {
24 /// The range of the span in the source text.
25 pub span_range: SpanRange,
26 /// A vector of key and optional value pairs representing attributes of the table.
27 pub attributes: Vec<Attribute>,
28}
29
30/// Represents an associated table identifier listed inside a table group.
31#[derive(Debug, Clone, Default)]
32pub struct TableGroupItem {
33 /// The range of the span in the source text.
34 pub span_range: SpanRange,
35 /// The table schema.
36 pub schema: Option<Ident>,
37 /// The table name or alias.
38 pub ident_alias: Ident,
39}