Example #1
0
func NewTagMatcher(queryString string) TagMatcher {
	path := tagPath.NewTagPath()
	last := make([]string, 1000)
	q := queryParser.Parse(queryString)
	qHasAttributes := false
	qHasPath := false
	tAttr := make([]int, 1024*4)
	for i := 0; i < q.PathPos; i++ {
		if q.Path[i].AttributePos > 0 {
			qHasAttributes = true
		}
		if len(q.Path[i].Name) > 0 {
			qHasPath = true
		}
	}

	return TagMatcher{query: *q, queryHasAttributes: qHasAttributes,
		queryHasPath:     qHasPath,
		path:             *path,
		lastMatchPath:    last,
		lastMatchPos:     0,
		tmpAttr:          tAttr,
		tmpAttrPos:       0,
		EqualityFn:       EqFnEqulas,
		CaseSensitive:    true,
		WithoutNamespace: false}
}
Example #2
0
func Parse(query string) *tagPath.TagPath {
	split := strings.Split(query, "/")
	path := tagPath.NewTagPath()
	for _, value := range split {
		tagText := strings.TrimSpace(value)
		if len(tagText) != 0 {
			addTag(tagText, path)
		}
	}
	return path
}