From 5e4dc87ffec7f87bbf3ebfcf256777ad773e8450 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 14 Mar 2020 16:47:38 +0100 Subject: cache: replace the all-in-one query parser by a complete one with AST/lexer/parser --- graphql/resolvers/repo.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'graphql/resolvers/repo.go') 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 { -- cgit From 314fcbb2293d869c33d6a76aedd148aedff6561d Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sun, 22 Mar 2020 13:53:34 +0100 Subject: query: no need for an ast package --- graphql/resolvers/repo.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'graphql/resolvers/repo.go') diff --git a/graphql/resolvers/repo.go b/graphql/resolvers/repo.go index dde1dcf6..639e8f90 100644 --- a/graphql/resolvers/repo.go +++ b/graphql/resolvers/repo.go @@ -9,7 +9,6 @@ import ( "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{} @@ -29,7 +28,7 @@ func (repoResolver) AllBugs(_ context.Context, obj *models.Repository, after *st Last: last, } - var q *ast.Query + var q *query.Query if queryStr != nil { query2, err := query.Parse(*queryStr) if err != nil { @@ -37,7 +36,7 @@ func (repoResolver) AllBugs(_ context.Context, obj *models.Repository, after *st } q = query2 } else { - q = ast.NewQuery() + q = query.NewQuery() } // Simply pass a []string with the ids to the pagination algorithm -- cgit