walkers

package
v3.3.2+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 8, 2018 License: Apache-2.0 Imports: 0 Imported by: 0

README

TSL Logo

Tree Search Language (TSL) Imperial Walkers (IW)

sql

The sql package include a helper sql.Walk (code, doc) method that adds search to squirrel's SelectBuilder object.

mongo

The mongo package include a helper mongo.Walk (code, doc) method that adds search bson filter to mongo-go-driver.

graphviz

The graphviz package include a helper graphviz.Walk (code, doc) method that exports .dot file nodes.

ident

The 'ident' package include a helper ident.Walk (code, doc) method that checks and mapps identifier names.

Documentation

Overview

Package walkers examples TSL tree walking, and helps to generate SQL and MongoDB query filters. sql.Walk and mongo.Walk methods can be used to create such filters.

Squirrel walk code: https://github.com/yaacov/tsl/blob/master/pkg/walkers/sql/walk.go

SQL generation example: https://github.com/yaacov/tsl/blob/master/cmd/tsl_sqlite/main.go

Usage:

filter, err := sql.Walk(tree)

sql, args, err := sq.Select("name, city, state").
     From("users").
     Where(filter).
     ToSql()

BSON walk code: https://github.com/yaacov/tsl/blob/master/pkg/walkers/mongo/walk.go

BSON generation example: https://github.com/yaacov/tsl/blob/master/cmd/tsl_mongo/main.go

Usage:

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

// Run query
cur, err := collection.Find(ctx, filter)

squirrel: https://github.com/Masterminds/squirrel

mongo-go-driver: https://github.com/mongodb/mongo-go-driver

Directories

Path Synopsis
Package graphviz helps to create graphviz dot files using the TSL package.
Package graphviz helps to create graphviz dot files using the TSL package.
Package ident helps to replace identifiers in a TSL tree.
Package ident helps to replace identifiers in a TSL tree.
Package mongo helps to create mongo BSON filters using the TSL package.
Package mongo helps to create mongo BSON filters using the TSL package.
Package sql helps to create SQL squirrel filters using the TSL package.
Package sql helps to create SQL squirrel filters using the TSL package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL