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