You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.4 KiB
59 lines
1.4 KiB
package graph2
|
|
|
|
import (
|
|
"git.aiterp.net/rpdata/api/graph2/graphcore"
|
|
"git.aiterp.net/rpdata/api/graph2/resolvers"
|
|
"git.aiterp.net/rpdata/api/graph2/types"
|
|
"git.aiterp.net/rpdata/api/services"
|
|
graphql "github.com/99designs/gqlgen/graphql"
|
|
)
|
|
|
|
//go:generate go run github.com/99designs/gqlgen -v
|
|
|
|
// New creates a new GraphQL schema.
|
|
func New(s *services.Bundle) graphql.ExecutableSchema {
|
|
return graphcore.NewExecutableSchema(graphcore.Config{
|
|
Resolvers: &rootResolver{s},
|
|
Complexity: complexity(),
|
|
})
|
|
}
|
|
|
|
type rootResolver struct {
|
|
s *services.Bundle
|
|
}
|
|
|
|
func (r *rootResolver) Query() graphcore.QueryResolver {
|
|
return resolvers.QueryResolver(r.s)
|
|
}
|
|
|
|
func (r *rootResolver) Mutation() graphcore.MutationResolver {
|
|
return resolvers.MutationResolver(r.s)
|
|
}
|
|
|
|
func (r *rootResolver) Subscription() graphcore.SubscriptionResolver {
|
|
return resolvers.SubscriptionResolver(r.s)
|
|
}
|
|
|
|
func (r *rootResolver) Log() graphcore.LogResolver {
|
|
return types.LogResolver(r.s)
|
|
}
|
|
|
|
func (r *rootResolver) Comment() graphcore.CommentResolver {
|
|
return types.CommentResolver(r.s)
|
|
}
|
|
|
|
func (r *rootResolver) Chapter() graphcore.ChapterResolver {
|
|
return types.ChapterResolver(r.s)
|
|
}
|
|
|
|
func (r *rootResolver) Story() graphcore.StoryResolver {
|
|
return types.StoryResolver(r.s)
|
|
}
|
|
|
|
func (r *rootResolver) Change() graphcore.ChangeResolver {
|
|
return &types.ChangeResolver
|
|
}
|
|
|
|
func (r *rootResolver) Token() graphcore.TokenResolver {
|
|
return types.TokenResolver(r.s)
|
|
}
|