package predicate
import "github.com/gohugoio/hugo/common/predicate"
Index ¶
- Variables
- type BoolMatch
- type IndexMatcher
- type Match
- type P
- func NewStringPredicateFromGlobs(patterns []string, getGlob func(pattern string) (glob.Glob, error)) (P[string], error)
- func (p P[T]) Or(ps ...P[T]) P[T]
- type PR
Variables ¶
var ( // Predefined Match values for common cases. True = BoolMatch(true) False = BoolMatch(false) )
Types ¶
type BoolMatch ¶
type BoolMatch bool
BoolMatch is a simple Match implementation based on a boolean value.
func (BoolMatch) OK ¶
type IndexMatcher ¶
type Match ¶
type Match interface {
OK() bool
}
Match represents the result of a predicate evaluation.
type P ¶
P is a predicate function that tests whether a value of type T satisfies some condition.
func NewStringPredicateFromGlobs ¶
func NewStringPredicateFromGlobs(patterns []string, getGlob func(pattern string) (glob.Glob, error)) (P[string], error)
NewStringPredicateFromGlobs creates a string predicate from the given glob patterns. A glob pattern starting with "!" is a negation pattern which will be ANDed with the rest.
func (P[T]) Or ¶
Or returns a predicate that is a short-circuiting logical OR of this and the given predicates. Note that P[T] only supports Or. For chained AND/OR logic, use PR[T].
type PR ¶
PR is a predicate function that tests whether a value of type T satisfies some condition and returns a Match result.
func (PR[T]) And ¶
And returns a predicate that is a short-circuiting logical AND of this and the given predicates.
func (PR[T]) BoolFunc ¶
BoolFunc returns a P[T] version of this predicate.
func (PR[T]) Filter ¶
func (p PR[T]) Filter(s []T) []T
Filter returns a new slice holding only the elements of s that satisfy p. Filter modifies the contents of the slice s and returns the modified slice, which may have a smaller length.
func (PR[T]) FilterCopy ¶
func (p PR[T]) FilterCopy(s []T) []T
FilterCopy returns a new slice holding only the elements of s that satisfy p.
func (PR[T]) Or ¶
Or returns a predicate that is a short-circuiting logical OR of this and the given predicates.
Source Files ¶
- Version
- v0.153.4 (latest)
- Published
- Dec 28, 2025
- Platform
- linux/amd64
- Imports
- 4 packages
- Last checked
- 4 months ago –
Tools for package owners.