use crate::embedded::EmbeddedSqlFileFacts;
use no_mistakes_postgres_sql::statement_facts::{SqlLocationDemand, SqlStatementFileFacts};
use no_mistakes_postgres_sql::statements::StatementPolicySources;
mod embedded;
mod rebase;
#[cfg(test)]
mod tests;
pub use rebase::rebase_embedded_lines;
pub fn embedded_call_facts(
file: &EmbeddedSqlFileFacts,
collect_bounds: bool,
variants_only: bool,
) -> Vec<SqlStatementFileFacts> {
embedded_call_facts_with_locations(file, collect_bounds, variants_only, false)
}
pub fn embedded_call_facts_with_locations(
file: &EmbeddedSqlFileFacts,
collect_bounds: bool,
variants_only: bool,
exact_locations: bool,
) -> Vec<SqlStatementFileFacts> {
embedded_call_facts_with_demand(
file,
collect_bounds,
variants_only,
if exact_locations {
SqlLocationDemand::Full
} else {
SqlLocationDemand::None
},
)
}
pub fn embedded_call_facts_with_demand(
file: &EmbeddedSqlFileFacts,
collect_bounds: bool,
variants_only: bool,
demand: SqlLocationDemand,
) -> Vec<SqlStatementFileFacts> {
embedded_call_facts_with_json_writes(
file,
collect_bounds,
variants_only,
demand,
false,
false,
false,
)
}
pub fn embedded_call_facts_with_json_writes(
file: &EmbeddedSqlFileFacts,
collect_bounds: bool,
variants_only: bool,
demand: SqlLocationDemand,
collect_json_writes: bool,
collect_index_probes: bool,
collect_body_bounds: bool,
) -> Vec<SqlStatementFileFacts> {
embedded_call_facts_with_policy(
file,
collect_bounds,
variants_only,
demand,
StatementPolicySources {
collect_json_writes,
collect_index_probes,
collect_body_bounds,
..Default::default()
},
)
}
pub fn embedded_call_facts_with_policy(
file: &EmbeddedSqlFileFacts,
collect_bounds: bool,
variants_only: bool,
demand: SqlLocationDemand,
policy: StatementPolicySources<'_>,
) -> Vec<SqlStatementFileFacts> {
embedded::embedded_call_facts_with_policy(file, collect_bounds, variants_only, demand, policy)
}