Help us shape the future of Go! Take the 2026 Go Developer Survey

rules

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2026 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRule

func ParseRule(ruleStr string, priority int) (models.Rule, error)

ParseRule parses CLI rule string e.g.: "type=video && size>1GB -> Videos/Large" "name=~'^IMG_' -> Camera" "*.mp4 -> Videos" "size>500MB -> Huge"

func ParseSize

func ParseSize(s string) (int64, error)

ParseSize parses human readable byte sizes: "500KB", "1GB", "2.5MB", "1024"

Types

type Engine

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

Engine evaluates rules against files

func NewEngine

func NewEngine(rules []models.Rule) *Engine

NewEngine creates a new Rule Engine

func (*Engine) Evaluate

func (e *Engine) Evaluate(file models.File) (*models.Rule, string, bool)

Evaluate finds the highest priority matching rule for a file

Jump to

Keyboard shortcuts

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