find_identifier_span

Function find_identifier_span 

Source
pub fn find_identifier_span(
    sql: &str,
    identifier: &str,
    search_start: usize,
) -> Option<Span>
Expand description

Finds the byte offset span of an identifier in SQL text.

Searches for the identifier as a whole word (not part of another identifier). Returns the first match found, or None if not found.

§Arguments

  • sql - The SQL source text
  • identifier - The identifier to find (table name, column name, etc.)
  • search_start - Byte offset to start searching from (for multi-statement SQL)

§Example

let sql = "SELECT * FROM users WHERE id = 1";
let span = find_identifier_span(sql, "users", 0);
assert_eq!(span, Some(Span { start: 14, end: 19 }));