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 subscription_stmt;
32
33use std::collections::HashMap;
34
35use crate::identifier::QualifiedName;
36use crate::ir::catalog::Catalog;
37use crate::parse::error::SourceLocation;
38
39#[derive(Debug, Default)]
42pub struct Builder {
43 pub catalog: Catalog,
45 pub locations: HashMap<String, SourceLocation>,
47}
48
49impl Builder {
50 pub fn new() -> Self {
52 Self::default()
53 }
54
55 pub fn record_location(
58 &mut self,
59 qname: &QualifiedName,
60 location: SourceLocation,
61 ) -> Option<SourceLocation> {
62 let key = qname.to_string();
63 if let Some(prior) = self.locations.get(&key) {
64 return Some(prior.clone());
65 }
66 self.locations.insert(key, location);
67 None
68 }
69}