pgevolve_core/parse/builder/
mod.rs1pub mod aggregate_stmt;
8pub mod alter_table_attach_partition;
9pub mod alter_table_stmt;
10pub mod cast_stmt;
11pub mod comment_stmt;
12pub mod create_collation_stmt;
13pub mod create_composite_type_stmt;
14pub mod create_domain_stmt;
15pub mod create_enum_stmt;
16pub mod create_extension_stmt;
17pub mod create_function_stmt;
18pub mod create_materialized_view_stmt;
19pub mod create_range_stmt;
20pub mod create_schema_stmt;
21pub mod create_seq_stmt;
22pub mod create_stmt;
23pub mod create_trigger_stmt;
24pub mod create_view_stmt;
25pub mod default_privileges;
26pub mod desugar_serial;
27pub mod event_trigger_stmt;
28pub mod grants;
29pub mod index_stmt;
30pub mod owner_stmt;
31pub mod plpgsql;
32pub mod policy_stmt;
33pub mod publication_stmt;
34pub mod reloptions;
35pub mod shared;
36pub mod statistic_stmt;
37pub mod subscription_stmt;
38
39use std::collections::HashMap;
40
41use crate::identifier::QualifiedName;
42use crate::ir::catalog::Catalog;
43use crate::parse::error::SourceLocation;
44
45#[derive(Debug, Default)]
48pub struct Builder {
49 pub catalog: Catalog,
51 pub locations: HashMap<String, SourceLocation>,
53}
54
55impl Builder {
56 pub fn new() -> Self {
58 Self::default()
59 }
60
61 pub fn record_location(
64 &mut self,
65 qname: &QualifiedName,
66 location: SourceLocation,
67 ) -> Option<SourceLocation> {
68 let key = qname.to_string();
69 if let Some(prior) = self.locations.get(&key) {
70 return Some(prior.clone());
71 }
72 self.locations.insert(key, location);
73 None
74 }
75}