views

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 10 Imported by: 0 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 views loads saved queries from <vault>/.nota/views/*.yaml and evaluates them through the index. A view is a virtual folder:

name: Drafts
icon: pen
where: { status: draft }
tag: projekt
folder: Projekt
sort: updated desc
limit: 50

Every field except name is optional. where matches frontmatter values (case-insensitive, list items included); tag includes nested tags.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Eval

func Eval(ix *index.Index, vw View) ([]index.Entry, error)

Eval runs the view against the index.

Types

type View

type View struct {
	// ID is the file name without extension; `nota ls --view ID` uses it.
	ID     string         `yaml:"-" json:"id"`
	Name   string         `yaml:"name" json:"name"`
	Icon   string         `yaml:"icon,omitempty" json:"icon,omitempty"`
	Where  map[string]any `yaml:"where,omitempty" json:"where,omitempty"`
	Tag    string         `yaml:"tag,omitempty" json:"tag,omitempty"`
	Folder string         `yaml:"folder,omitempty" json:"folder,omitempty"`
	Sort   string         `yaml:"sort,omitempty" json:"sort,omitempty"`
	Limit  int            `yaml:"limit,omitempty" json:"limit,omitempty"`
	// File is the vault-relative path of the definition.
	File string `yaml:"-" json:"file"`
}

View is one saved query.

func Find

func Find(vs []View, name string) (View, bool)

Find returns the view whose ID or name matches name, ignoring case.

func Load

func Load(v *vault.Vault) ([]View, error)

Load reads every *.yaml and *.yml file in the vault's views directory, sorted by name. A missing directory means no views. A broken file fails the whole load with an error that names the file.

func Parse

func Parse(data []byte) (View, error)

Parse decodes and validates one view definition.

func (View) Query

func (vw View) Query() (index.Query, error)

Query turns the view into an index query.

Jump to

Keyboard shortcuts

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