Documentation ¶
Index ¶
- type AddQuestionInput
- type AddTranslationInput
- type AllQuestionOut
- type Drawlosseum
- type FibbingIt
- type GenericQuestion
- type GenericQuestionGroup
- type GetQuestionIDsInput
- type GetQuestionInput
- type GroupInput
- type GroupNameParams
- type LanguageParams
- type LanguageQueryParams
- type LimitParams
- type ListQuestionParams
- type Question
- type QuestionAPI
- func (env *QuestionAPI) AddQuestion(_ *gin.Context, questionInput *AddQuestionInput) (string, error)
- func (env *QuestionAPI) AddTranslation(_ *gin.Context, questionInput *AddTranslationInput) error
- func (env *QuestionAPI) DisableQuestion(_ *gin.Context, questionInput *QuestionInput) (struct{}, error)
- func (env *QuestionAPI) EnableQuestion(_ *gin.Context, questionInput *QuestionInput) (struct{}, error)
- func (env *QuestionAPI) GetAllGroups(_ *gin.Context, groupInput *GroupInput) ([]string, error)
- func (env *QuestionAPI) GetAllLanguages(_ *gin.Context, gameNameParam *internal.GameParams) ([]string, error)
- func (env *QuestionAPI) GetQuestion(_ *gin.Context, questionInput *GetQuestionInput) (QuestionGenericOut, error)
- func (env *QuestionAPI) GetQuestions(_ *gin.Context, params *ListQuestionParams) ([]QuestionOut, error)
- func (env *QuestionAPI) GetQuestionsIDs(_ *gin.Context, questionInput *GetQuestionIDsInput) (AllQuestionOut, error)
- func (env *QuestionAPI) RemoveQuestion(_ *gin.Context, questionInput *QuestionInput) error
- func (env *QuestionAPI) RemoveTranslation(_ *gin.Context, questionInput *QuestionLanguageInput) error
- type QuestionGenericOut
- type QuestionGroup
- type QuestionGroupInOut
- type QuestionIDParams
- type QuestionIDs
- type QuestionIn
- type QuestionInput
- type QuestionLanguageInput
- type QuestionOut
- type QuestionService
- func (q *QuestionService) Add() (string, error)
- func (q *QuestionService) AddTranslation(content string, langCode string) error
- func (q *QuestionService) Get() (Question, error)
- func (q *QuestionService) GetAll(limit int64, cursor string) (QuestionIDs, error)
- func (q *QuestionService) GetGroups(round string) ([]string, error)
- func (q *QuestionService) GetLanguages() ([]string, error)
- func (q *QuestionService) GetList(searchParam SearchParams) (Questions, error)
- func (q *QuestionService) Remove() error
- func (q *QuestionService) RemoveTranslation(languageCode string) error
- func (q *QuestionService) UpdateEnable(enabled bool) (bool, error)
- type QuestionTranslationIn
- type Questioner
- type Questions
- func (questions *Questions) Add(db database.Database) error
- func (questions Questions) Delete(db database.Database, filter map[string]interface{}) (bool, error)
- func (questions *Questions) Get(db database.Database, filter map[string]interface{}) error
- func (questions *Questions) GetRandom(db database.Database, filter map[string]interface{}, limit int64) error
- func (questions *Questions) GetWithLimit(db database.Database, filter map[string]interface{}, limit int64) error
- func (questions Questions) ToInterface() []interface{}
- type Quibly
- type SearchParams
- type UpdateQuestion
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddQuestionInput ¶
type AddQuestionInput struct { internal.GameParams QuestionIn }
type AddTranslationInput ¶
type AddTranslationInput struct { internal.GameParams LanguageParams QuestionIDParams QuestionTranslationIn }
type AllQuestionOut ¶
type Drawlosseum ¶
type Drawlosseum struct{}
func (Drawlosseum) HasGroups ¶
func (d Drawlosseum) HasGroups(_ string) bool
func (Drawlosseum) ValidateQuestion ¶
func (d Drawlosseum) ValidateQuestion(_ QuestionIn) error
type FibbingIt ¶
type FibbingIt struct{}
func (FibbingIt) ValidateQuestion ¶
func (f FibbingIt) ValidateQuestion(question QuestionIn) error
type GenericQuestion ¶
type GenericQuestion struct { Content string Round string LanguageCode string Group *GenericQuestionGroup }
type GenericQuestionGroup ¶
type GetQuestionIDsInput ¶
type GetQuestionIDsInput struct { internal.GameParams LimitParams Cursor string `description:"The ID to start at for retrieving ID" example:"60e777f2d24d7d711e971aee" query:"cursor"` }
type GetQuestionInput ¶
type GetQuestionInput struct { internal.GameParams LanguageParams QuestionIDParams }
type GroupInput ¶
type GroupInput struct { internal.GameParams internal.RoundParams }
type GroupNameParams ¶
type GroupNameParams struct {
GroupName string `description:"The name of the group." example:"horse" query:"group_name"`
}
type LanguageParams ¶
type LanguageParams struct {
Language string `description:"The language code for the new question." example:"fr" path:"language"`
}
type LanguageQueryParams ¶
type LanguageQueryParams struct {
Language string `description:"The language code for the new question." example:"fr" default:"en" query:"language"`
}
type LimitParams ¶
type LimitParams struct {
Limit int64 `description:"The number of questions to retrieve." query:"limit" default:"5" validate:"gte=0,lte=100"`
}
type ListQuestionParams ¶
type ListQuestionParams struct { internal.GameParams internal.RoundParams LanguageQueryParams GroupNameParams LimitParams Enabled string `` /* 133-byte string literal not displayed */ Random bool `description:"If set will retrieve questions randomly." query:"random"` }
type Question ¶
type Question struct { ID string `bson:"id"` GameName string `bson:"game_name" json:"game_name"` Round string `bson:"round,omitempty"` Enabled *bool `bson:"enabled"` Content map[string]string `bson:"content"` Group *QuestionGroup `bson:"group,omitempty"` }
type QuestionAPI ¶
func (*QuestionAPI) AddQuestion ¶
func (env *QuestionAPI) AddQuestion(_ *gin.Context, questionInput *AddQuestionInput) (string, error)
func (*QuestionAPI) AddTranslation ¶
func (env *QuestionAPI) AddTranslation(_ *gin.Context, questionInput *AddTranslationInput) error
func (*QuestionAPI) DisableQuestion ¶
func (env *QuestionAPI) DisableQuestion(_ *gin.Context, questionInput *QuestionInput) (struct{}, error)
func (*QuestionAPI) EnableQuestion ¶
func (env *QuestionAPI) EnableQuestion(_ *gin.Context, questionInput *QuestionInput) (struct{}, error)
func (*QuestionAPI) GetAllGroups ¶
func (env *QuestionAPI) GetAllGroups(_ *gin.Context, groupInput *GroupInput) ([]string, error)
func (*QuestionAPI) GetAllLanguages ¶
func (env *QuestionAPI) GetAllLanguages(_ *gin.Context, gameNameParam *internal.GameParams) ([]string, error)
func (*QuestionAPI) GetQuestion ¶
func (env *QuestionAPI) GetQuestion(_ *gin.Context, questionInput *GetQuestionInput) (QuestionGenericOut, error)
func (*QuestionAPI) GetQuestions ¶
func (env *QuestionAPI) GetQuestions(_ *gin.Context, params *ListQuestionParams) ([]QuestionOut, error)
func (*QuestionAPI) GetQuestionsIDs ¶
func (env *QuestionAPI) GetQuestionsIDs(_ *gin.Context, questionInput *GetQuestionIDsInput) (AllQuestionOut, error)
func (*QuestionAPI) RemoveQuestion ¶
func (env *QuestionAPI) RemoveQuestion(_ *gin.Context, questionInput *QuestionInput) error
func (*QuestionAPI) RemoveTranslation ¶
func (env *QuestionAPI) RemoveTranslation(_ *gin.Context, questionInput *QuestionLanguageInput) error
type QuestionGenericOut ¶
type QuestionGenericOut struct { Content string `` /* 163-byte string literal not displayed */ Round string `json:"round,omitempty" description:"If the game has rounds, specify the round in this field." example:"opinion"` Enabled bool `json:"enabled" description:"True if the question is enabled and can be used in a game, else false."` Group *QuestionGroupInOut `json:"group,omitempty"` }
type QuestionGroup ¶
type QuestionGroupInOut ¶
type QuestionIDParams ¶
type QuestionIDParams struct {
ID string `description:"The id for a specific question." example:"a-random-id" path:"question_id"`
}
type QuestionIDs ¶
type QuestionIn ¶
type QuestionIn struct { Content string `` /* 157-byte string literal not displayed */ LanguageCode string `` /* 170-byte string literal not displayed */ Round string `json:"round,omitempty" description:"If the game has rounds, specify the round in this field." example:"opinion"` Group *QuestionGroupInOut `json:"group,omitempty"` }
type QuestionInput ¶
type QuestionInput struct { internal.GameParams QuestionIDParams }
type QuestionLanguageInput ¶
type QuestionLanguageInput struct { internal.GameParams LanguageParams QuestionIDParams }
type QuestionOut ¶
type QuestionService ¶
type QuestionService struct { DB database.Database GameName string QuestionID string Question GenericQuestion }
func (*QuestionService) Add ¶
func (q *QuestionService) Add() (string, error)
func (*QuestionService) AddTranslation ¶
func (q *QuestionService) AddTranslation(content string, langCode string) error
func (*QuestionService) Get ¶
func (q *QuestionService) Get() (Question, error)
func (*QuestionService) GetAll ¶
func (q *QuestionService) GetAll(limit int64, cursor string) (QuestionIDs, error)
func (*QuestionService) GetGroups ¶
func (q *QuestionService) GetGroups(round string) ([]string, error)
func (*QuestionService) GetLanguages ¶
func (q *QuestionService) GetLanguages() ([]string, error)
func (*QuestionService) GetList ¶
func (q *QuestionService) GetList(searchParam SearchParams) (Questions, error)
func (*QuestionService) Remove ¶
func (q *QuestionService) Remove() error
func (*QuestionService) RemoveTranslation ¶
func (q *QuestionService) RemoveTranslation(languageCode string) error
func (*QuestionService) UpdateEnable ¶
func (q *QuestionService) UpdateEnable(enabled bool) (bool, error)
type QuestionTranslationIn ¶
type QuestionTranslationIn struct {
Content string `json:"content" description:"The question in the new language" example:"Willst du eine Frage?" validate:"required"`
}
type Questioner ¶
type Questioner interface { ValidateQuestion(question QuestionIn) error HasGroups(_ string) bool }
func GetGame ¶
func GetGame(name string) (Questioner, error)
type Questions ¶
type Questions []Question
func (*Questions) GetWithLimit ¶
func (Questions) ToInterface ¶
func (questions Questions) ToInterface() []interface{}
type Quibly ¶
type Quibly struct{}
func (Quibly) ValidateQuestion ¶
func (q Quibly) ValidateQuestion(question QuestionIn) error
type SearchParams ¶
Click to show internal directories.
Click to hide internal directories.