hints

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Code generated by "string-enumer -t Match -o match_enumer___generated.go ."; DO NOT EDIT.

Code generated by "string-enumer -t Type -o type_enumer___generated.go ."; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Hint

type Hint struct {
	// Pattern to match against the asset's name.
	Pattern string `single:"true"`
	// Weight used to adjust the score for non-mandatory hints.
	Weight unmarshal.Templatable[int]
	// Type determines the engine used to match the pattern.
	Type Type `validate:"oneof=glob regex globstar startswith endswith contains"`
	// Match indicates the type of match.
	Match unmarshal.Templatable[Match]
}

Hint represents a pattern used to match asset names. It can be a regular expression or a simple string pattern.

func (Hint) Matches

func (h Hint) Matches(s string) (match bool, err error)

Matches evaluates whether the hint pattern matches the given string.

func (*Hint) Parse

func (h *Hint) Parse() (err error)

Parse validates and prepares the hint for matching operations.

func (*Hint) UnmarshalYAML

func (h *Hint) UnmarshalYAML(node ast.Node) error

UnmarshalYAML implements the yaml.Unmarshaler interface for Hint.

type Hints

Hints represents a collection of Hint objects used to evaluate asset matches.

func (*Hints) Add

func (h *Hints) Add(hints ...Hint)

Add appends a set of hints to the current collection.

func (*Hints) Append

func (h *Hints) Append(hints Hints)

Append appends a set of hints to the current collection.

func (*Hints) Has

func (h *Hints) Has() bool

Has returns true if the Hints collection contains any hints.

func (*Hints) Parse

func (h *Hints) Parse() error

Parse validates and prepares all hints in the collection.

func (*Hints) Reduced

func (h *Hints) Reduced() *Hints

Reduced removes any Hint with an empty Pattern.

func (*Hints) UnmarshalYAML

func (h *Hints) UnmarshalYAML(node ast.Node) (err error)

UnmarshalYAML implements the yaml.Unmarshaler interface for Hints.

type Match

type Match string

Match represents different matching strategies for hints.

const (
	// Weighted indicates that the hint is a weighted match.
	Weighted Match = "weighted"
	// Required indicates that the hint is a required match.
	Required Match = "required"
	// Excluded indicates that the hint is an excluded match.
	Excluded Match = "excluded"
)

func MatchValues

func MatchValues() []Match

MatchValues returns a list of all (valid) Match values

func (Match) Valid

func (v Match) Valid() bool

Valid validates if a value is a valid Match

type Type

type Type string

Type represents different pattern matching types for hints.

const (
	// Glob indicates that the hint is a glob pattern.
	Glob Type = "glob"
	// Regex indicates that the hint is a regular expression.
	Regex Type = "regex"
	// GlobStar indicates that the hint is a globstar pattern.
	GlobStar Type = "globstar"
	// StartsWith indicates that the hint is a startswith pattern.
	StartsWith Type = "startswith"
	// EndsWith indicates that the hint is an endswith pattern.
	EndsWith Type = "endswith"
	// Contains indicates that the hint is a contains pattern.
	Contains Type = "contains"
)

func TypeValues

func TypeValues() []Type

TypeValues returns a list of all (valid) Type values

func (Type) Valid

func (v Type) Valid() bool

Valid validates if a value is a valid Type

Jump to

Keyboard shortcuts

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