GraphQL API and utilities for the rpdata project
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.

56 lines
1.2 KiB

  1. package graph2
  2. import (
  3. "git.aiterp.net/rpdata/api/graph2/queries"
  4. "git.aiterp.net/rpdata/api/graph2/types"
  5. graphql "github.com/99designs/gqlgen/graphql"
  6. )
  7. //go:generate ./combine.sh
  8. //go:generate go run github.com/99designs/gqlgen -v
  9. // New creates a new GraphQL schema.
  10. func New() graphql.ExecutableSchema {
  11. return NewExecutableSchema(Config{
  12. Resolvers: &rootResolver{},
  13. Complexity: complexity(),
  14. })
  15. }
  16. type rootResolver struct{}
  17. func (r *rootResolver) Query() QueryResolver {
  18. return &queries.Resolver
  19. }
  20. func (r *rootResolver) Mutation() MutationResolver {
  21. return queries.MutationResolver
  22. }
  23. func (r *rootResolver) Subscription() SubscriptionResolver {
  24. return queries.SubscriptionResolver
  25. }
  26. func (r *rootResolver) Log() LogResolver {
  27. return &types.LogResolver
  28. }
  29. func (r *rootResolver) Comment() CommentResolver {
  30. return &types.CommentResolver
  31. }
  32. func (r *rootResolver) Chapter() ChapterResolver {
  33. return &types.ChapterResolver
  34. }
  35. func (r *rootResolver) Story() StoryResolver {
  36. return &types.StoryResolver
  37. }
  38. func (r *rootResolver) Change() ChangeResolver {
  39. return &types.ChangeResolver
  40. }
  41. func (r *rootResolver) Token() TokenResolver {
  42. return &types.TokenResolver
  43. }