readgraph

package
v0.0.0-...-4d14c86 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Process

func Process(ctx context.Context, db bun.IDB, links bool) *run

Process reads the notes sorted by path, or by id with their tags and [[links]] when links is set.

Types

type Link struct {
	Source   string  `json:"source"`
	Target   string  `json:"target"`
	Strength float64 `json:"strength,omitempty" binding:"optional"`
}

Link is a [[link]] between two notes, once per pair (Source < Target) whichever way it goes. Laid out: its pull.

type Note

type Note struct {
	ID    string      `json:"id"`
	Title secret.Text `json:"title" swaggertype:"string"`
	Path  string      `json:"path"`
	Tags  []string    `json:"tags,omitempty" binding:"optional"`
	X     float64     `json:"x,omitempty" binding:"optional"`
	Y     float64     `json:"y,omitempty" binding:"optional"`
}

Note is a node of the graph, with its tags: the tags are nodes too, joined to their notes. Laid out (layoutgraph): its place in % of the view, never 0 (a margin keeps it off the edges).

func Match

func Match(notes []Note, q string, limit int) []Note

Match keeps at most limit named notes whose title or path holds q whatever its case: the ones named q (title or path) first, then the titles starting with it, in the order of notes between equals.

type Result

type Result struct {
	Notes        []Note                       `json:"notes"`
	Links        []Link                       `json:"links"`
	TagPositions map[string]forcelayout.Point `json:"tag_positions,omitempty" binding:"optional"`
	TagWeights   map[string]float64           `json:"tag_weights,omitempty" binding:"optional"`
}

Result is every live note, with its tags, and the [[links]] between them. Laid out: the place of each tag, by name, and its weight: a tag pulls a note by its weight / the note's tags, sent once per tag, not once per note. Its size follows the tags put on notes, not the pairs of notes sharing one (n² for a tag on n notes).

Jump to

Keyboard shortcuts

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