no-mistakes-postgres-sql 0.109.130

PostgreSQL SQL parsing, statement facts, and identifier extraction for no-mistakes
Documentation
use super::SqlFunctionClause;
use crate::statement_facts::{SqlIsolation, SqlIsolationChanges};

/// One function expression, excluding column and alias identifiers.
#[derive(Debug, Clone, PartialEq, Eq)]
#[non_exhaustive]
pub struct SqlFunctionCallFact {
    pub name_parts: Vec<String>,
    pub line: usize,
    pub column: usize,
    /// None for calls outside the supported clauses, including FROM and GROUP BY.
    pub clause: Option<SqlFunctionClause>,
    #[doc(hidden)]
    pub in_cte: bool,
    pub(crate) in_stored_routine: bool,
}

impl SqlFunctionCallFact {
    /// Construct a call fact outside a CTE.
    pub fn new(
        name_parts: Vec<String>,
        line: usize,
        column: usize,
        clause: Option<SqlFunctionClause>,
    ) -> Self {
        Self {
            name_parts,
            line,
            column,
            clause,
            in_cte: false,
            in_stored_routine: false,
        }
    }

    pub fn isolation_at(
        &self,
        isolation: &SqlIsolationChanges,
        line: usize,
        column: usize,
        inherited: Option<SqlIsolation>,
    ) -> SqlIsolation {
        if self.in_stored_routine {
            SqlIsolation::Unknown
        } else {
            isolation.at(line, column, inherited)
        }
    }
}