sqlode/query_analyzer/embed_rewriter

Expand sqlode.embed(TABLE) macro calls into concrete qualified column lists inside an already-tokenized query. The rewriter is meant to run after column_inferencer.infer_result_columns so that the EmbeddedResult entries it receives already have the table’s column list resolved against the catalog.

Values

pub fn rewrite(
  tokens: List(lexer.Token),
  result_columns: List(model.ResultItem),
) -> List(lexer.Token)

Rewrite token list, replacing every sqlode.embed(TABLE) occurrence with a comma-separated list of qualified columns derived from the matching EmbeddedResult in result_columns.

If result_columns contains no EmbeddedResult, tokens are returned unchanged — callers can use this to short-circuit re-rendering when there is nothing to do.

Search Document