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