Documentation
¶
Overview ¶
Package query is the single source of truth for codenav's read operations: search, definition, references, callers, callees and call-path. The CLI (and, later, MCP/HTTP) are thin presenters over these functions.
Index ¶
- func CallPath(db *sql.DB, fromIdent, toIdent string, maxDepth, limit int) ([][]graph.Node, error)
- func Callees(db *sql.DB, ident string, depth int) ([]graph.Node, error)
- func Callers(db *sql.DB, ident string, depth int) ([]graph.Node, error)
- func Impact(db *sql.DB, seeds []string, depth int) ([]graph.Node, error)
- type Hub
- type Overview
- type RefHit
- type RouteHit
- type SearchHit
- type SymbolHit
- func Def(db *sql.DB, ident string, includeBody bool) ([]SymbolHit, error)
- func ListSymbols(db *sql.DB, repo, kind string, limit int) ([]SymbolHit, error)
- func Outline(db *sql.DB, file, repo string) ([]SymbolHit, error)
- func SymbolsInRange(db *sql.DB, repo, file string, lo, hi int) ([]SymbolHit, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Hub ¶
type Hub struct {
QName string `json:"qname"`
Kind string `json:"kind"`
File string `json:"file"`
Line int `json:"line"`
Callers int `json:"callers"`
}
Hub is a heavily-called symbol — a good place to start understanding a repo.
type Overview ¶
Overview is a cold-start architecture summary: counts by kind and the most heavily-called symbols (entry points / hubs).
type RefHit ¶
type RefHit struct {
File string `json:"file"`
Line int `json:"line"`
Col int `json:"col"`
Role string `json:"role,omitempty"`
In string `json:"in,omitempty"`
Text string `json:"text,omitempty"`
}
RefHit is a use-site of a symbol. In names the symbol that encloses the reference and Text is the trimmed source line, so one refs call answers "who uses this, and how" without opening each file.
type RouteHit ¶
type RouteHit struct {
Method string `json:"method"`
Pattern string `json:"pattern"`
Handler string `json:"handler,omitempty"`
File string `json:"file,omitempty"`
Line int `json:"line,omitempty"`
Framework string `json:"framework,omitempty"`
}
RouteHit is a detected web route, optionally bound to a handler symbol.
type SearchHit ¶
type SearchHit struct {
QName string `json:"qname,omitempty"`
Name string `json:"name,omitempty"`
Kind string `json:"kind,omitempty"`
File string `json:"file"`
Line int `json:"line,omitempty"`
Snippet string `json:"snippet,omitempty"`
}
SearchHit is a search result (symbol-name or code-body).
func SearchCode ¶
SearchCode runs a BM25 full-text search over file bodies.
type SymbolHit ¶
type SymbolHit struct {
QName string `json:"qname"`
Name string `json:"name"`
Kind string `json:"kind"`
Signature string `json:"signature,omitempty"`
File string `json:"file"`
Line int `json:"line"`
EndLine int `json:"end_line,omitempty"`
Fidelity string `json:"fidelity,omitempty"`
Snippet string `json:"snippet,omitempty"`
}
SymbolHit is a resolved definition, optionally with a source snippet. EndLine makes the hit a precise edit target: callers that want to change the symbol can address File:Line-EndLine with their own editor instead of first reading the whole file to locate it.
func Def ¶
Def returns matching definitions, each as a precise edit target (File + Line-EndLine). With includeBody it also attaches the source snippet; without it returns signature + location only, the token-frugal default for agents that just need to locate the symbol before editing with their own tools.
func ListSymbols ¶
ListSymbols lists definitions (an entry point for exploring a codebase cold), optionally filtered by repo and kind. limit <= 0 means no limit.