pub struct LintContext<'a> {
pub sql: &'a str,
pub statement_range: Range<usize>,
pub statement_index: usize,
}Expand description
Context provided to lint rules during analysis.
Fields§
§sql: &'a strThe full SQL source text.
statement_range: Range<usize>Byte range of the current statement within the SQL source.
statement_index: usizeZero-based index of the current statement.
Implementations§
Source§impl<'a> LintContext<'a>
impl<'a> LintContext<'a>
Sourcepub fn statement_sql(&self) -> &str
pub fn statement_sql(&self) -> &str
Returns the SQL text for the current statement.
Sourcepub fn span_from_statement_offset(&self, start: usize, end: usize) -> Span
pub fn span_from_statement_offset(&self, start: usize, end: usize) -> Span
Converts a byte offset relative to the statement into an absolute Span.
Sourcepub fn with_document_tokens<T>(
&self,
f: impl FnOnce(&[TokenWithSpan]) -> T,
) -> T
pub fn with_document_tokens<T>( &self, f: impl FnOnce(&[TokenWithSpan]) -> T, ) -> T
Invokes f with the active document token stream, if available.
Tokens include location spans from the single tokenizer pass performed
during LintDocument construction.
Sourcepub fn is_templated(&self) -> bool
pub fn is_templated(&self) -> bool
Returns true if the document was processed through a templater (Jinja, dbt, etc.) before linting.
Auto Trait Implementations§
impl<'a> Freeze for LintContext<'a>
impl<'a> RefUnwindSafe for LintContext<'a>
impl<'a> Send for LintContext<'a>
impl<'a> Sync for LintContext<'a>
impl<'a> Unpin for LintContext<'a>
impl<'a> UnsafeUnpin for LintContext<'a>
impl<'a> UnwindSafe for LintContext<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more