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.
|
|
package models
import ( "fmt" "io" )
// StoryCategory represents the category of a story.
type StoryCategory string
const ( // StoryCategoryInfo is a story category, see GraphQL documentation.
StoryCategoryInfo StoryCategory = "Info" // StoryCategoryNews is a story category, see GraphQL documentation.
StoryCategoryNews StoryCategory = "News" // StoryCategoryDocument is a story category, see GraphQL documentation.
StoryCategoryDocument StoryCategory = "Document" // StoryCategoryBackground is a story category, see GraphQL documentation.
StoryCategoryBackground StoryCategory = "Background" // StoryCategoryStory is a story category, see GraphQL documentation.
StoryCategoryStory StoryCategory = "Story" )
// UnmarshalGQL unmarshals
func (e *StoryCategory) UnmarshalGQL(v interface{}) error { str, ok := v.(string) if !ok { return fmt.Errorf("enums must be strings") }
*e = StoryCategory(str) switch *e { case StoryCategoryInfo, StoryCategoryNews, StoryCategoryDocument, StoryCategoryBackground, StoryCategoryStory: return nil default: return fmt.Errorf("%s is not a valid StoryCategory", str) } }
// MarshalGQL turns it into a JSON string
func (e StoryCategory) MarshalGQL(w io.Writer) { fmt.Fprint(w, "\""+string(e)+"\"") }
|