Documentation

Index

Constants

This section is empty.

Variables

View Source
var NoMatch = PrioritiesCnt

Functions

func SetTagMatchDetails

func SetTagMatchDetails(
	tag TagPather, pathComponentIdx, matchedNameIdx int, prio Priority,
	det *MatchDetails,
)

Types

type ByPathItemIdxAndPrio

type ByPathItemIdxAndPrio []TagPather

func (ByPathItemIdxAndPrio) Len

func (a ByPathItemIdxAndPrio) Len() int

func (ByPathItemIdxAndPrio) Less

func (a ByPathItemIdxAndPrio) Less(i, j int) bool

func (ByPathItemIdxAndPrio) Swap

func (a ByPathItemIdxAndPrio) Swap(i, j int)

type MatchDetails

type MatchDetails struct {
}

type Matcher

type Matcher interface {
	Filter(tags []TagPather, pattern string) []*Result
}

type MatcherExact

type MatcherExact struct {
}

func (*MatcherExact) Filter

func (m *MatcherExact) Filter(tags []TagPather, pattern string) []*Result

type MatcherType

type MatcherType int
const (
	MatcherTypeExact MatcherType = iota
	MatcherTypeFuzzy
	MatcherTypeExactThenFuzzy
)

type Priority

type Priority int
const (
	ExactMatch Priority = iota
	BeginMatch
	EndMatch
	MiddleMatch
	FuzzyMatch

	PrioritiesCnt
)

type Result

type Result struct {
	ItemsMap map[int]struct{}
}

func NewResult

func NewResult() *Result

func (*Result) Add

func (r *Result) Add(idx int)

func (*Result) Exists

func (r *Result) Exists(idx int) bool

func (*Result) Len

func (r *Result) Len() int

type TagMatcher

type TagMatcher struct {
	DefMatcherType MatcherType
}

func NewTagMatcher

func NewTagMatcher() *TagMatcher

func (*TagMatcher) Filter

func (m *TagMatcher) Filter(tags []TagPather, pattern string) ([]TagPather, error)

type TagPather

type TagPather interface {
	Path() string
	PathItems() [][]string
	SetMatchDetails(
		pathComponentIdx, matchedNameIdx int, prio Priority,
		det *MatchDetails,
	)

	SetMaxPathItemIdx(pathComponentIdx int, prio Priority)
	GetMaxPathItemIdx() int
	GetMaxPathItemIdxRev() int
	GetPrio() Priority
}

TODO: find a better name

func CombineResults

func CombineResults(results []*Result, tags []TagPather) []TagPather