Skip to content

Commit

Permalink
Merge branch 'hotfix/0.1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
takama committed Nov 8, 2014
2 parents 7dcff34 + c26e46a commit 5024cf6
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ A tags package for use with Go (golang) services
- All strict Tags applied with logical operator "AND" between each other
- All non-strict Tags applied with logical operator "OR" between all tags

### Queries

{"a","b"} this mean that we ask "a" OR "b" tag

{"a","+b","+c"} this mean that we ask "a" OR ("b" AND "c") tag

{"a","+b", "c", "-d"} this mean that we ask "a" OR "c" OR ("b" AND NOT "d") tag

### Example

```go
Expand Down Expand Up @@ -45,6 +53,7 @@ func main() {

fmt.Println("Product:", product.Description)

// We ask for any tee "black" or "green"
fmt.Println("Is this tee black or green?")
query := tags.Tags{"black", "green"}

Expand All @@ -54,6 +63,7 @@ func main() {
fmt.Println("No, the tee has not black or green options.")
}

// We ask fot strict match "green" and "sugar"
fmt.Println("Is this tee green with sugar?")
query = tags.Tags{"+green", "+sugar"}

Expand All @@ -63,6 +73,7 @@ func main() {
fmt.Println("No, the tee with sugar, but is not green.")
}

// We ask for strict mismatch, not "ice"
fmt.Println("Is this tee hot?")
query = tags.Tags{"-ice"}

Expand Down
3 changes: 3 additions & 0 deletions example/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ func main() {

fmt.Println("Product:", product.Description)

// We ask for any tee "black" or "green"
fmt.Println("Is this tee black or green?")
query := tags.Tags{"black", "green"}

Expand All @@ -31,6 +32,7 @@ func main() {
fmt.Println("No, the tee has not black or green options.")
}

// We ask fot strict match "green" and "sugar"
fmt.Println("Is this tee green with sugar?")
query = tags.Tags{"+green", "+sugar"}

Expand All @@ -40,6 +42,7 @@ func main() {
fmt.Println("No, the tee with sugar, but is not green.")
}

// We ask for strict mismatch, not "ice"
fmt.Println("Is this tee hot?")
query = tags.Tags{"-ice"}

Expand Down
11 changes: 10 additions & 1 deletion tags.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// that can be found in the LICENSE file.

/*
Package tags 0.1.3
Package tags 0.1.4
Definition:
Expand All @@ -17,6 +17,12 @@ Rules:
- All strict Tags applied with logical operator "AND" between each other
- All non-strict Tags applied with logical operator "OR" between all tags
Queries:
{"a","b"} this mean that we ask "a" OR "b" tag
{"a","+b","+c"} this mean that we ask "a" OR ("b" AND "c") tag
{"a","+b", "c", "-d"} this mean that we ask "a" OR "c" OR ("b" AND NOT "d") tag
Example:
package main
Expand All @@ -43,6 +49,7 @@ Example:
fmt.Println("Product:", product.Description)
// We ask for any tee "black" or "green"
fmt.Println("Is this tee black or green?")
query := tags.Tags{"black", "green"}
Expand All @@ -52,6 +59,7 @@ Example:
fmt.Println("No, the tee has not black or green options.")
}
// We ask fot strict match "green" and "sugar"
fmt.Println("Is this tee green with sugar?")
query = tags.Tags{"+green", "+sugar"}
Expand All @@ -61,6 +69,7 @@ Example:
fmt.Println("No, the tee with sugar, but is not green.")
}
// We ask for strict mismatch, not "ice"
fmt.Println("Is this tee hot?")
query = tags.Tags{"-ice"}
Expand Down

0 comments on commit 5024cf6

Please sign in to comment.