dbml_rs/ast/
project.rs

1use alloc::string::String;
2use alloc::vec::Vec;
3use core::str::FromStr;
4
5use super::*;
6
7/// Represents different types of databases.
8#[derive(Debug, Clone)]
9pub enum DatabaseType {
10  PostgreSQL,
11  Unknown(String)
12}
13
14impl FromStr for DatabaseType {
15  type Err = String;
16
17  fn from_str(s: &str) -> Result<Self, Self::Err> {
18    match s {
19      "PostgreSQL" => Ok(Self::PostgreSQL),
20      _ => Ok(Self::Unknown(String::from(s))),
21    }
22  }
23}
24
25/// Represents a project block for grouping various tables.
26#[derive(Debug, Clone, Default)]
27pub struct ProjectBlock {
28  /// Range of the span in the source text.
29  pub span_range: SpanRange,
30  /// Properties associated with the project block.
31  pub properties: Vec<Property>,
32  /// An identifier of the project block.
33  pub ident: Ident,
34  /// The database type associated with the project block.
35  pub database_type: Option<DatabaseType>,
36  /// The note block associated with the project block.
37  pub note: Option<NoteBlock>,
38}