diff options
author | Michael Muré <batolettre@gmail.com> | 2020-03-14 16:47:38 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-03-28 17:13:27 +0100 |
commit | 5e4dc87ffec7f87bbf3ebfcf256777ad773e8450 (patch) | |
tree | 04553cfb7ab8ea279c7415586ce1d0fe5c819996 /graphql/resolvers | |
parent | 58abc6b0a35b679ac0c34579ff1cb53c8fa71af4 (diff) | |
download | git-bug-5e4dc87ffec7f87bbf3ebfcf256777ad773e8450.tar.gz |
cache: replace the all-in-one query parser by a complete one with AST/lexer/parser
Diffstat (limited to 'graphql/resolvers')
-rw-r--r-- | graphql/resolvers/repo.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/graphql/resolvers/repo.go b/graphql/resolvers/repo.go index d090544d..dde1dcf6 100644 --- a/graphql/resolvers/repo.go +++ b/graphql/resolvers/repo.go @@ -4,11 +4,12 @@ import ( "context" "github.com/MichaelMure/git-bug/bug" - "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/graphql/connections" "github.com/MichaelMure/git-bug/graphql/graph" "github.com/MichaelMure/git-bug/graphql/models" + "github.com/MichaelMure/git-bug/query" + "github.com/MichaelMure/git-bug/query/ast" ) var _ graph.RepositoryResolver = &repoResolver{} @@ -28,19 +29,19 @@ func (repoResolver) AllBugs(_ context.Context, obj *models.Repository, after *st Last: last, } - var query *cache.Query + var q *ast.Query if queryStr != nil { - query2, err := cache.ParseQuery(*queryStr) + query2, err := query.Parse(*queryStr) if err != nil { return nil, err } - query = query2 + q = query2 } else { - query = cache.NewQuery() + q = ast.NewQuery() } // Simply pass a []string with the ids to the pagination algorithm - source := obj.Repo.QueryBugs(query) + source := obj.Repo.QueryBugs(q) // The edger create a custom edge holding just the id edger := func(id entity.Id, offset int) connections.Edge { |