Move query interface definitions into query
This commit is contained in:
parent
38f7b79761
commit
a6cf432313
7 changed files with 74 additions and 70 deletions
11
db/repl.go
11
db/repl.go
|
|
@ -27,6 +27,7 @@ import (
|
|||
"github.com/google/cayley/graph"
|
||||
"github.com/google/cayley/graph/sexp"
|
||||
"github.com/google/cayley/quad/cquads"
|
||||
"github.com/google/cayley/query"
|
||||
"github.com/google/cayley/query/gremlin"
|
||||
"github.com/google/cayley/query/mql"
|
||||
)
|
||||
|
|
@ -41,7 +42,7 @@ func un(s string, startTime time.Time) {
|
|||
fmt.Printf(s, float64(endTime.UnixNano()-startTime.UnixNano())/float64(1E6))
|
||||
}
|
||||
|
||||
func Run(query string, ses graph.Session) {
|
||||
func Run(query string, ses query.Session) {
|
||||
nResults := 0
|
||||
startTrace, startTime := trace("Elapsed time: %g ms\n\n")
|
||||
defer func() {
|
||||
|
|
@ -62,7 +63,7 @@ func Run(query string, ses graph.Session) {
|
|||
}
|
||||
|
||||
func Repl(ts graph.TripleStore, queryLanguage string, cfg *config.Config) error {
|
||||
var ses graph.Session
|
||||
var ses query.Session
|
||||
switch queryLanguage {
|
||||
case "sexp":
|
||||
ses = sexp.NewSession(ts)
|
||||
|
|
@ -140,13 +141,13 @@ func Repl(ts graph.TripleStore, queryLanguage string, cfg *config.Config) error
|
|||
}
|
||||
result, err := ses.InputParses(string(line))
|
||||
switch result {
|
||||
case graph.Parsed:
|
||||
case query.Parsed:
|
||||
Run(string(line), ses)
|
||||
line = line[:0]
|
||||
case graph.ParseFail:
|
||||
case query.ParseFail:
|
||||
fmt.Println("Error: ", err)
|
||||
line = line[:0]
|
||||
case graph.ParseMore:
|
||||
case query.ParseMore:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue