query

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 31, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package query parses named DML query files (sqlc-style annotations) and maps each query to a pluginv1.Query IR node.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Infer

func Infer(q *pluginv1.Query, cat *irv1.Catalog, d *catalog.Diagnostics)

Infer mutates q by:

  1. Walking the AST to collect ParameterRef nodes → QueryParameter entries.
  2. Attempting shallow type inference for parameters by examining operator operands — if a param appears beside a resolved ColumnRef, the param inherits the column's type.
  3. For SELECT queries, resolving SelectTarget nodes to QueryColumn entries.

Unresolvable items produce a diagnostic but never a panic.

func ParseQueries

func ParseQueries(sql, sourceFile string) ([]*pluginv1.Query, error)

ParseQueries scans sql for named query blocks, parses each, and returns the resulting []*pluginv1.Query.

A query block begins with a header comment:

-- name: QueryName :command

and extends until the next header (or EOF). If a body fails to parse it is silently skipped; the caller may emit a diagnostic.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL