package resolver import "git.aiterp.net/rpdata/api/model/story" // TagResolver for the Tag graphql type type TagResolver struct{ T story.Tag } // TagInput resolves the TagInput input type TagInput struct { Kind string Name string } // Tags implements the tags query func (r *QueryResolver) Tags() ([]*TagResolver, error) { tags, err := story.ListTags() if err != nil { return nil, err } resolvers := make([]*TagResolver, len(tags)) for i, tag := range tags { resolvers[i] = &TagResolver{T: tag} } return resolvers, nil } // Kind resolves Tag.kind func (r *TagResolver) Kind() string { return r.T.Kind } // Name resolves Tag.name func (r *TagResolver) Name() string { return r.T.Name }