mirror of
https://github.com/MichaelMure/git-bug.git
synced 2024-12-15 02:01:43 +03:00
better naming for the graphql-s root resolver
This commit is contained in:
parent
0514edad1a
commit
fba56eda83
@ -12,20 +12,20 @@ import (
|
|||||||
|
|
||||||
type Handler struct {
|
type Handler struct {
|
||||||
http.HandlerFunc
|
http.HandlerFunc
|
||||||
*resolvers.Backend
|
*resolvers.RootResolver
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewHandler(repo repository.Repo) (Handler, error) {
|
func NewHandler(repo repository.Repo) (Handler, error) {
|
||||||
h := Handler{
|
h := Handler{
|
||||||
Backend: resolvers.NewBackend(),
|
RootResolver: resolvers.NewRootResolver(),
|
||||||
}
|
}
|
||||||
|
|
||||||
err := h.Backend.RegisterDefaultRepository(repo)
|
err := h.RootResolver.RegisterDefaultRepository(repo)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return Handler{}, err
|
return Handler{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
h.HandlerFunc = handler.GraphQL(graph.NewExecutableSchema(h.Backend))
|
h.HandlerFunc = handler.GraphQL(graph.NewExecutableSchema(h.RootResolver))
|
||||||
|
|
||||||
return h, nil
|
return h, nil
|
||||||
}
|
}
|
||||||
|
@ -5,52 +5,52 @@ import (
|
|||||||
"github.com/MichaelMure/git-bug/graphql/graph"
|
"github.com/MichaelMure/git-bug/graphql/graph"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Backend struct {
|
type RootResolver struct {
|
||||||
cache.RootCache
|
cache.RootCache
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBackend() *Backend {
|
func NewRootResolver() *RootResolver {
|
||||||
return &Backend{
|
return &RootResolver{
|
||||||
RootCache: cache.NewCache(),
|
RootCache: cache.NewCache(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r Backend) Query() graph.QueryResolver {
|
func (r RootResolver) Query() graph.QueryResolver {
|
||||||
return &rootQueryResolver{
|
return &rootQueryResolver{
|
||||||
cache: &r.RootCache,
|
cache: &r.RootCache,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r Backend) Mutation() graph.MutationResolver {
|
func (r RootResolver) Mutation() graph.MutationResolver {
|
||||||
return &mutationResolver{
|
return &mutationResolver{
|
||||||
cache: &r.RootCache,
|
cache: &r.RootCache,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Backend) AddCommentOperation() graph.AddCommentOperationResolver {
|
func (RootResolver) AddCommentOperation() graph.AddCommentOperationResolver {
|
||||||
return &addCommentOperationResolver{}
|
return &addCommentOperationResolver{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r Backend) Bug() graph.BugResolver {
|
func (r RootResolver) Bug() graph.BugResolver {
|
||||||
return &bugResolver{}
|
return &bugResolver{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Backend) CreateOperation() graph.CreateOperationResolver {
|
func (RootResolver) CreateOperation() graph.CreateOperationResolver {
|
||||||
return &createOperationResolver{}
|
return &createOperationResolver{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Backend) LabelChangeOperation() graph.LabelChangeOperationResolver {
|
func (RootResolver) LabelChangeOperation() graph.LabelChangeOperationResolver {
|
||||||
return &labelChangeOperation{}
|
return &labelChangeOperation{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r Backend) Repository() graph.RepositoryResolver {
|
func (r RootResolver) Repository() graph.RepositoryResolver {
|
||||||
return &repoResolver{}
|
return &repoResolver{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Backend) SetStatusOperation() graph.SetStatusOperationResolver {
|
func (RootResolver) SetStatusOperation() graph.SetStatusOperationResolver {
|
||||||
return &setStatusOperationResolver{}
|
return &setStatusOperationResolver{}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (Backend) SetTitleOperation() graph.SetTitleOperationResolver {
|
func (RootResolver) SetTitleOperation() graph.SetTitleOperationResolver {
|
||||||
return &setTitleOperationResolver{}
|
return &setTitleOperationResolver{}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user