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.

27 lines
527 B

  1. package resolver
  2. import (
  3. "git.aiterp.net/rpdata/api/model/story"
  4. "git.aiterp.net/rpdata/api/resolver/types"
  5. )
  6. // TagInput resolves the TagInput input
  7. type TagInput struct {
  8. Kind string
  9. Name string
  10. }
  11. // Tags implements the tags query
  12. func (r *QueryResolver) Tags() ([]*types.TagResolver, error) {
  13. tags, err := story.ListTags()
  14. if err != nil {
  15. return nil, err
  16. }
  17. resolvers := make([]*types.TagResolver, len(tags))
  18. for i, tag := range tags {
  19. resolvers[i] = &types.TagResolver{T: tag}
  20. }
  21. return resolvers, nil
  22. }