query

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderBacklinks(results []BacklinksResult, target string, format string) error

RenderBacklinks renders backlinks results in the specified format

func RenderNeighbors

func RenderNeighbors(results []NeighborsResult, root string, format string) error

RenderNeighbors renders neighbors results in the specified format

func RenderPaths

func RenderPaths(results []PathResult, source string, format string) error

RenderPaths renders paths results in the specified format

func RenderResults

func RenderResults(results []SearchResult, format string) error

RenderResults renders search results in the specified format

Types

type BacklinksQuery

type BacklinksQuery struct {
	Target    string   // Target node (type:key or just key)
	Direction string   // "in", "out", or "both" (default: "in")
	EdgeTypes []string // Filter by edge types (inclusive)
	Format    string   // Output format: "table" or "json"
}

BacklinksQuery represents a backlinks query

func NewBacklinksQuery

func NewBacklinksQuery() *BacklinksQuery

NewBacklinksQuery creates a new backlinks query with defaults

type BacklinksResult

type BacklinksResult struct {
	HopCount int          `json:"hop_count"`
	Nodes    []graph.Node `json:"nodes"`
	Edges    []graph.Edge `json:"edges"`
}

BacklinksResult represents a single backlink path

func ExecuteBacklinks(vaultRoot string, q *BacklinksQuery) ([]BacklinksResult, error)

ExecuteBacklinks executes a backlinks query

type NeighborsQuery

type NeighborsQuery struct {
	Root        string       // Root node (type:key or just key)
	Direction   string       // "in", "out", or "both" (default: "both")
	MaxDepth    int          // Maximum depth (required, no default)
	EdgeTypes   []string     // Filter by edge types (inclusive)
	NodeFilters *SearchQuery // Node filters for result set
	Format      string       // Output format: "table" or "json"
}

NeighborsQuery represents a neighbors query

func NewNeighborsQuery

func NewNeighborsQuery() *NeighborsQuery

NewNeighborsQuery creates a new neighbors query with defaults

type NeighborsResult

type NeighborsResult struct {
	Depth int          `json:"depth"`
	Nodes []graph.Node `json:"nodes"`
}

NeighborsResult represents neighbors at a specific depth

func ExecuteNeighbors

func ExecuteNeighbors(vaultRoot string, q *NeighborsQuery) ([]NeighborsResult, error)

ExecuteNeighbors executes a neighbors query using BFS

type Path

type Path struct {
	Nodes []graph.Node
	Edges []graph.Edge
}

Path represents a path through the graph

type PathResult

type PathResult struct {
	Source      string       `json:"source"`
	Destination string       `json:"destination"`
	HopCount    int          `json:"hop_count"`
	Nodes       []graph.Node `json:"nodes"`
	Edges       []graph.Edge `json:"edges"`
}

PathResult represents a path between source and destination

func ExecutePaths

func ExecutePaths(vaultRoot string, q *PathsQuery) ([]PathResult, error)

ExecutePaths executes a paths query using BFS shortest-path

type PathsQuery

type PathsQuery struct {
	Source       string       // Source node (type:key or just key)
	Destinations []string     // Destination nodes (type:key or just key) - supports multiple
	Direction    string       // "in", "out", or "both" (default: "both")
	MaxDepth     int          // Maximum depth (required, no default)
	MaxPaths     int          // Maximum number of paths per destination (default: 10)
	EdgeTypes    []string     // Filter by edge types (inclusive)
	NodeFilters  *SearchQuery // Node filters for result set
	Format       string       // Output format: "table" or "json"
}

PathsQuery represents a paths query

func NewPathsQuery

func NewPathsQuery() *PathsQuery

NewPathsQuery creates a new paths query with defaults

type SearchQuery

type SearchQuery struct {
	Types       []string // Filter by types (CSV)
	States      []string // Filter by states (CSV)
	Tags        []string // Filter by tags (CSV)
	MatchAnyTag bool     // If true, match any tag; if false, match all tags
	Limit       *int     // Limit number of results
	Offset      int      // Offset for pagination
	Format      string   // Output format: "table" or "json"
}

SearchQuery represents a search query AST

func NewSearchQuery

func NewSearchQuery() *SearchQuery

NewSearchQuery creates a new search query with defaults

type SearchResult

type SearchResult struct {
	ID      string
	Type    string
	Key     string
	Title   string
	State   string
	Created string
	Updated string
	Path    string
	Tags    []string
}

SearchResult represents a single search result

func ExecuteSearch

func ExecuteSearch(vaultRoot string, q *SearchQuery) ([]SearchResult, error)

ExecuteSearch executes a search query and returns results

Jump to

Keyboard shortcuts

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