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 /// The settings for the table group.
17 pub settings: Option<TableGroupSettings>,
18}
19
20/// Represents settings of the table group.
21#[derive(Debug, Clone, Default)]
22pub struct TableGroupSettings {
23 /// The range of the span in the source text.
24 pub span_range: SpanRange,
25 /// A vector of key and optional value pairs representing attributes of the table.
26 pub attributes: Vec<Attribute>,
27}
28
29/// Represents an associated table identifier listed inside a table group.
30#[derive(Debug, Clone, Default)]
31pub struct TableGroupItem {
32 /// The range of the span in the source text.
33 pub span_range: SpanRange,
34 /// The table schema.
35 pub schema: Option<Ident>,
36 /// The table name or alias.
37 pub ident_alias: Ident,
38}