hints

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 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)

func (*Hint) Parse

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

func (*Hint) UnmarshalYAML

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

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

func (*Hints) Parse

func (h *Hints) Parse() error

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)

type Match

type Match string
const (
	// Weighted indicates that the hint is a weighted match.
	Weighted Match = "weighted"
	// Require indicates that the hint is a required match.
	Required Match = "required"
	// Exclude 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
const (
	// TypeGlob indicates that the hint is a glob pattern.
	Glob Type = "glob"
	// TypeRegex indicates that the hint is a regular expression.
	Regex Type = "regex"
	// TypeGlobStar indicates that the hint is a globstar pattern.
	GlobStar Type = "globstar"
	// TypeStartsWith indicates that the hint is a startswith pattern.
	StartsWith Type = "startswith"
	// TypeEndsWith indicates that the hint is an endswith pattern.
	EndsWith Type = "endswith"
	// TypeContains 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