dqlhint

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package dqlhint turns a DQL error reported by the Grail query API into repair hints: a caret-marked snippet of the offending query text, and — for a small table of known authoring traps — a corrected query.

The rules are deliberately conservative. Each one fires only when the error type, its arguments, the reported position, and the query text all agree on the same mistake; anything less produces no hint. An agent that receives a wrong "fix" loses more turns than one that receives none.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Snippet

func Snippet(query string, span Span) string

Snippet renders the query line holding the start of span with a caret line underneath marking the span. A span that continues on later lines is marked to the end of its first line. It returns "" when span does not point into query.

func Suggest

func Suggest(e Error) []string

Suggest returns the repair suggestions for a query error, most specific first. Rewrites are rendered as a runnable `dtctl query '…'` command preceded by the reason, so the caller learns the rule and not just the fix.

Types

type Error

type Error struct {
	// Type is the Grail error type, e.g. PARSE_ERROR.
	Type string
	// Arguments are the error message's format arguments, e.g. the offending
	// token or parameter name.
	Arguments []string
	// Query is the query as the backend parsed it; Span indexes into it.
	Query string
	Span  *Span
}

Error is the part of a Grail query error the rules read.

type Span

type Span struct {
	StartLine, StartColumn int
	EndLine, EndColumn     int
}

Span is the offending part of a query: 1-based line and column, measured in characters, with the end inclusive. A zero EndLine means the end is unknown and the span covers a single character.

Jump to

Keyboard shortcuts

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