assertion

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assertion

type Assertion struct {
	Path     pathsyntax.Path
	Operator OpType
	Value    string // raw YAML value string for comparison (empty for exists/not exists)
}

Assertion represents a parsed assertion expression.

func ParseAssertion

func ParseAssertion(expr string) (*Assertion, error)

ParseAssertion parses an assertion expression string. Format: "<path> <operator> [<value>]" Examples:

".title exists"
".count >= 3"
".tags contains \"go\""
".draft == false"
".title not exists"

func (*Assertion) Evaluate

func (a *Assertion) Evaluate(doc *frontmatter.Document) error

Evaluate checks the assertion against the document. Returns nil if the assertion passes, error with explanation if it fails.

type OpType

type OpType int

OpType represents the assertion operator.

const (
	OpExists OpType = iota
	OpNotExists
	OpEquals
	OpNotEquals
	OpContains
	OpNotContains
	OpLessThan
	OpLessEqual
	OpGreaterThan
	OpGreaterEqual
)

Jump to

Keyboard shortcuts

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