33// that can be found in the LICENSE file.
44
55/*
6- Package tags 0.1.1
6+ Package tags 0.1.2
77
88Definition:
99
10- "Tags" - a strings which used for tag any object
11- "non-strict Tags" - a strings which match to strings in data ("new" -> "new")
12- "strict Tags" - all strict tags have prefix "+" for strict match ("+new")
13- and "-" for strict mismatch ("-old")
10+ - "Tags" - a strings which used for tag any object
11+ - "non-strict Tags" - a strings which match to strings in data ("new" -> "new")
12+ - "strict Tags" - all strict tags have prefix "+" for strict match ("+new")
13+ and "-" for strict mismatch ("-old")
1414
15- All strict Tags applied with logical operator "AND" between each other
16- All non-strict Tags applied with logical operator "OR" between all tags
15+ Rules:
16+
17+ - All strict Tags applied with logical operator "AND" between each other
18+ - All non-strict Tags applied with logical operator "OR" between all tags
1719
1820Example:
1921
@@ -43,6 +45,7 @@ Example:
4345
4446 fmt.Println("Is this tee black or green?")
4547 query := tags.Tags{"black", "green"}
48+
4649 if product.Tags.IsTagged(query) {
4750 fmt.Println("Yes, the tee is black.")
4851 } else {
@@ -51,6 +54,7 @@ Example:
5154
5255 fmt.Println("Is this tee green with sugar?")
5356 query = tags.Tags{"+green", "+sugar"}
57+
5458 if product.Tags.IsTagged(query) {
5559 fmt.Println("Yes, the tee is green with sugar.")
5660 } else {
@@ -59,6 +63,7 @@ Example:
5963
6064 fmt.Println("Is this tee hot?")
6165 query = tags.Tags{"-ice"}
66+
6267 if product.Tags.IsTagged(query) {
6368 fmt.Println("Yes, the tee is hot.")
6469 } else {
@@ -75,10 +80,10 @@ import (
7580 "strings"
7681)
7782
78- // Tags a slice of strings which used for tag any object
83+ // Tags is a slice of strings which used for tag any object
7984type Tags []string
8085
81- // IsTagged method checks if elements in a data compliant for tags in query
86+ // IsTagged - this method checks if Tags are matched with tags in query
8287func (t Tags ) IsTagged (query Tags ) bool {
8388 if len (query ) == 0 {
8489 return true
0 commit comments