Documentation
¶
Index ¶
- type CaertsianCoordinateColor
- type CurrentStoryInput
- type DrawingPoint
- type Drawlosseum
- type DrawlosseumAnswers
- type DrawlosseumAnswersInOut
- type FibbingIt
- type FibbingItAnswer
- type FibbingItAnswerInOut
- type FibbingItAnswers
- type FibbingItAnswersInOut
- type Gamer
- type NewStoryInput
- type Quibly
- type QuiblyAnswer
- type QuiblyAnswerInOut
- type QuiblyAnswers
- type QuiblyAnswersInOut
- type Stories
- func (stories *Stories) Add(db database.Database) error
- func (stories Stories) Delete(db database.Database, filter map[string]interface{}) (bool, error)
- func (stories *Stories) Get(db database.Database, filter map[string]interface{}) error
- func (stories *Stories) GetWithLimit(db database.Database, filter map[string]interface{}, limit int64) error
- func (stories Stories) ToInterface() []interface{}
- type Story
- func (story *Story) Add(db database.Database) (bool, error)
- func (story *Story) Get(db database.Database, filter map[string]interface{}) error
- func (story *Story) UnmarshalBSONValue(t bsontype.Type, data []byte) error
- func (story *Story) UnmarshalJSON(data []byte) error
- func (story *Story) Update(db database.Database, filter map[string]interface{}) (bool, error)
- type StoryAPI
- type StoryAnswerType
- type StoryAnswersInOut
- type StoryIDParams
- type StoryInOut
- type StoryService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CaertsianCoordinateColor ¶
type CaertsianCoordinateColor struct { Start DrawingPoint `bson:"start" json:"start"` End DrawingPoint `bson:"end" json:"end"` Color string `bson:"color" json:"color"` }
type CurrentStoryInput ¶
type CurrentStoryInput struct { internal.GameParams StoryIDParams }
type DrawingPoint ¶
type Drawlosseum ¶
type Drawlosseum struct{}
func (Drawlosseum) NewStory ¶
func (d Drawlosseum) NewStory(story StoryInOut) (Story, error)
func (Drawlosseum) NewStoryOut ¶
func (d Drawlosseum) NewStoryOut(story Story) (StoryInOut, error)
type DrawlosseumAnswers ¶
type DrawlosseumAnswers []CaertsianCoordinateColor
func (DrawlosseumAnswers) NewAnswer ¶
func (d DrawlosseumAnswers) NewAnswer()
type DrawlosseumAnswersInOut ¶
type DrawlosseumAnswersInOut []CaertsianCoordinateColor
type FibbingIt ¶
type FibbingIt struct{}
func (FibbingIt) NewStoryOut ¶
func (f FibbingIt) NewStoryOut(story Story) (StoryInOut, error)
type FibbingItAnswer ¶
type FibbingItAnswerInOut ¶
type FibbingItAnswers ¶
type FibbingItAnswers []FibbingItAnswer
func (FibbingItAnswers) NewAnswer ¶
func (f FibbingItAnswers) NewAnswer()
type FibbingItAnswersInOut ¶
type FibbingItAnswersInOut []FibbingItAnswerInOut
type Gamer ¶
type Gamer interface { NewStory(story StoryInOut) (Story, error) NewStoryOut(story Story) (StoryInOut, error) }
type NewStoryInput ¶
type NewStoryInput struct { internal.GameParams StoryInOut }
type Quibly ¶
type Quibly struct{}
func (Quibly) NewStoryOut ¶
func (q Quibly) NewStoryOut(story Story) (StoryInOut, error)
type QuiblyAnswer ¶
type QuiblyAnswerInOut ¶
type QuiblyAnswers ¶
type QuiblyAnswers []QuiblyAnswer
func (QuiblyAnswers) NewAnswer ¶
func (q QuiblyAnswers) NewAnswer()
type QuiblyAnswersInOut ¶
type QuiblyAnswersInOut []QuiblyAnswerInOut
type Stories ¶
type Stories []Story
func (*Stories) GetWithLimit ¶
func (Stories) ToInterface ¶
func (stories Stories) ToInterface() []interface{}
type Story ¶
type Story struct { GameName string `bson:"game_name" json:"game_name"` ID string `bson:"id"` Question string `bson:"question"` Round string `bson:"round,omitempty"` Nickname string `bson:"nickname,omitempty"` Answers StoryAnswerType `bson:"answers"` }
Story struct to contain information about a user story
func (*Story) UnmarshalBSONValue ¶
UnmarshalBSONValue is a custom unmarshal function, that will unmarshal question pools differently, i.e. answers field depending on the game name. As each has it's own question structure. The main purpose is just to get the raw BSON data for the `Answers` field.
Then, we work out the type of game, using `GameName`. Depending on the game we unmarshal the data into different structs and assign that to the `Questions` field of that `story` variable, which is of type `Story`. The `story`, is what is returned when we get the `Story` data from the database.
func (*Story) UnmarshalJSON ¶
UnmarshalJSON works almost the same way as the UnmarshalBSONValue method above.
type StoryAPI ¶
func (*StoryAPI) DeleteStory ¶
func (env *StoryAPI) DeleteStory(_ *gin.Context, params *CurrentStoryInput) error
func (*StoryAPI) GetStory ¶
func (env *StoryAPI) GetStory(_ *gin.Context, params *CurrentStoryInput) (StoryInOut, error)
type StoryAnswerType ¶
type StoryAnswerType interface {
NewAnswer()
}
type StoryAnswersInOut ¶
type StoryAnswersInOut struct { Drawlosseum DrawlosseumAnswersInOut `json:"drawlosseum,omitempty"` Quibly QuiblyAnswersInOut `json:"quibly,omitempty"` FibbingIt FibbingItAnswersInOut `json:"fibbing_it,omitempty"` }
func (StoryAnswersInOut) Answer ¶
func (s StoryAnswersInOut) Answer()
type StoryIDParams ¶
type StoryIDParams struct {
StoryID string `description:"The id for the story." example:"2b45f6c6-d8be-4d13-9fc6-2f821c925774" path:"story_id"`
}
type StoryInOut ¶
type StoryInOut struct { Question string `json:"question"` Round string `json:"round,omitempty"` Nickname string `json:"nickname,omitempty"` StoryAnswersInOut }