Skip to content

Commit 3b5026c

Browse files
committed
Merge branch 'hotfix/0.1.2'
2 parents 4fcc0d1 + 205201a commit 3b5026c

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

README.md

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@ A tags package for use with Go (golang) services
88

99
### Definitions
1010

11-
"Tags" - a strings which used for tag any object
12-
"non-strict Tags" - a strings which match to strings in data ("new" -> "new")
13-
"strict Tags" - all strict tags have prefix "+" for strict match ("+new")
11+
- "Tags" - a strings which used for tag any object
12+
- "non-strict Tags" - a strings which match to strings in data ("new" -> "new")
13+
- "strict Tags" - all strict tags have prefix "+" for strict match ("+new")
1414
and "-" for strict mismatch ("-old")
1515

16-
All strict Tags applied with logical operator "AND" between each other
17-
All non-strict Tags applied with logical operator "OR" between all tags
16+
### Rules
17+
18+
- All strict Tags applied with logical operator "AND" between each other
19+
- All non-strict Tags applied with logical operator "OR" between all tags
1820

1921
### Example
2022

@@ -45,6 +47,7 @@ func main() {
4547

4648
fmt.Println("Is this tee black or green?")
4749
query := tags.Tags{"black", "green"}
50+
4851
if product.Tags.IsTagged(query) {
4952
fmt.Println("Yes, the tee is black.")
5053
} else {
@@ -53,6 +56,7 @@ func main() {
5356

5457
fmt.Println("Is this tee green with sugar?")
5558
query = tags.Tags{"+green", "+sugar"}
59+
5660
if product.Tags.IsTagged(query) {
5761
fmt.Println("Yes, the tee is green with sugar.")
5862
} else {
@@ -61,6 +65,7 @@ func main() {
6165

6266
fmt.Println("Is this tee hot?")
6367
query = tags.Tags{"-ice"}
68+
6469
if product.Tags.IsTagged(query) {
6570
fmt.Println("Yes, the tee is hot.")
6671
} else {

example/example.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func main() {
2424

2525
fmt.Println("Is this tee black or green?")
2626
query := tags.Tags{"black", "green"}
27+
2728
if product.Tags.IsTagged(query) {
2829
fmt.Println("Yes, the tee is black.")
2930
} else {
@@ -32,6 +33,7 @@ func main() {
3233

3334
fmt.Println("Is this tee green with sugar?")
3435
query = tags.Tags{"+green", "+sugar"}
36+
3537
if product.Tags.IsTagged(query) {
3638
fmt.Println("Yes, the tee is green with sugar.")
3739
} else {
@@ -40,6 +42,7 @@ func main() {
4042

4143
fmt.Println("Is this tee hot?")
4244
query = tags.Tags{"-ice"}
45+
4346
if product.Tags.IsTagged(query) {
4447
fmt.Println("Yes, the tee is hot.")
4548
} else {

tags.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@
33
// that can be found in the LICENSE file.
44

55
/*
6-
Package tags 0.1.1
6+
Package tags 0.1.2
77
88
Definition:
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
1820
Example:
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
7984
type 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
8287
func (t Tags) IsTagged(query Tags) bool {
8388
if len(query) == 0 {
8489
return true

0 commit comments

Comments
 (0)