query

package
v0.3.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultMaxDepth = 32
	MaxDepthCap     = 128
)

Variables

This section is empty.

Functions

func Format

func Format(result *Result) string

func FormatBatch added in v0.3.0

func FormatBatch(result *Result, requested, missing []string) string

func FormatCompact

func FormatCompact(result *Result) string

func FormatDiffs added in v0.3.1

func FormatDiffs(diffs []*store.DiffRecord) string

func FormatRelated added in v0.3.0

func FormatRelated(related []*store.RelatedNode, budget int) string

Types

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func NewEngine

func NewEngine(s QueryStore) *Engine

func (*Engine) Delta

func (e *Engine) Delta(ctx context.Context, sinceSnapshot int64) ([]*store.DiffRecord, error)

func (*Engine) Diff added in v0.3.1

func (e *Engine) Diff(ctx context.Context, fromSnapshot, toSnapshot int64) ([]*store.DiffRecord, error)

func (*Engine) Fetch

func (e *Engine) Fetch(ctx context.Context, anchor string, budget, depth int) (*Result, error)

func (*Engine) FetchBatch added in v0.3.0

func (e *Engine) FetchBatch(ctx context.Context, ids []string, budget int) (*Result, []string, error)

func (*Engine) Search

func (e *Engine) Search(ctx context.Context, query string, budget int) (*Result, error)

type QueryStore

type QueryStore interface {
	GetNode(ctx context.Context, id string) (*store.Node, error)

	GetNodesByIDs(ctx context.Context, ids []string) ([]*store.Node, error)

	GetAncestors(ctx context.Context, id string) ([]*store.Node, error)

	GetDescendants(ctx context.Context, id string, maxDepth int) ([]*store.Node, error)

	GetSiblings(ctx context.Context, id string) ([]*store.Node, error)

	SearchRanked(ctx context.Context, query string, limit int) ([]*store.RankedNode, error)

	GetDiffsSince(ctx context.Context, sinceSnapshotID int64) ([]*store.DiffRecord, error)

	GetDiffsBetween(ctx context.Context, fromSnapshotID, toSnapshotID int64) ([]*store.DiffRecord, error)
}

type Result

type Result struct {
	Nodes      []ScoredNode
	TokensUsed int
}

type ScoredNode

type ScoredNode struct {
	Node  *store.Node
	Score float64
}

Jump to

Keyboard shortcuts

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