Skip to content

Commit

Permalink
add imports to readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
yaacov committed Dec 2, 2018
1 parent 42e63b9 commit b760caf
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ After parsing the TSL tree will look like this (image created using the `tsl_par
The TSL package include a helper [sql.Walk](/pkg/walkers/sql/walk.go) method that adds search to [squirrel](https://github.com/Masterminds/squirrel)'s SelectBuilder object:

``` go
import (
...
"github.com/yaacov/tsl/pkg/walkers/sql"
...
)

// Prepare squirrel filter.
filter, err := sql.Walk(tree)

Expand All @@ -86,6 +92,12 @@ SELECT name, city, state FROM users WHERE (name IN (?,?) AND grade NOT BETWEEN ?
The TSL package include a helper [mongo.Walk](/pkg/walkers/mongo/walk.go) method that adds search bson filter to [mongo-go-driver](https://github.com/mongodb/mongo-go-driver):

``` go
import (
...
"github.com/yaacov/tsl/pkg/walkers/mongo"
...
)

// Prepare a bson filter.
filter, err = mongo.Walk(tree)

Expand All @@ -98,6 +110,12 @@ cur, err := collection.Find(ctx, bson.D{filter})
The TSL package include a helper [graphviz.Walk](/pkg/walkers/graphviz/walk.go) method that exports `.dot` file nodes :

``` go
import (
...
"github.com/yaacov/tsl/pkg/walkers/graphviz"
...
)

// Prepare .dot file nodes as a string.
s, err = graphviz.Walk("", tree, "")

Expand Down

0 comments on commit b760caf

Please sign in to comment.