Make query/... interfaces more idiomatic
Also revert the data type returned by queries to interface{} (the change
made sense at the time).
This commit is contained in:
parent
ad7649806b
commit
21c2d75d07
11 changed files with 304 additions and 299 deletions
|
|
@ -37,11 +37,11 @@ func NewSession(qs graph.QuadStore) *Session {
|
|||
return &s
|
||||
}
|
||||
|
||||
func (s *Session) ToggleDebug() {
|
||||
s.debug = !s.debug
|
||||
func (s *Session) Debug(ok bool) {
|
||||
s.debug = ok
|
||||
}
|
||||
|
||||
func (s *Session) InputParses(input string) (query.ParseResult, error) {
|
||||
func (s *Session) Parse(input string) (query.ParseResult, error) {
|
||||
var parenDepth int
|
||||
for i, x := range input {
|
||||
if x == '(' {
|
||||
|
|
@ -67,7 +67,7 @@ func (s *Session) InputParses(input string) (query.ParseResult, error) {
|
|||
return query.ParseFail, errors.New("invalid syntax")
|
||||
}
|
||||
|
||||
func (s *Session) ExecInput(input string, out chan interface{}, limit int) {
|
||||
func (s *Session) Execute(input string, out chan interface{}, limit int) {
|
||||
it := BuildIteratorTreeForQuery(s.qs, input)
|
||||
newIt, changed := it.Optimize()
|
||||
if changed {
|
||||
|
|
@ -104,7 +104,7 @@ func (s *Session) ExecInput(input string, out chan interface{}, limit int) {
|
|||
close(out)
|
||||
}
|
||||
|
||||
func (s *Session) ToText(result interface{}) string {
|
||||
func (s *Session) Format(result interface{}) string {
|
||||
out := fmt.Sprintln("****")
|
||||
tags := result.(map[string]graph.Value)
|
||||
tagKeys := make([]string, len(tags))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue