quiz

package
v0.0.0-...-2bc59a2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2018 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartQuiz

func StartQuiz(c echo.Context) error

StartQuiz returns the logic to start the quiz game

Types

type Question

type Question struct {
	Category      string   `json:"category"`
	Type          string   `json:"type"`
	Difficulty    string   `json:"difficulty"`
	CorrectAnswer string   `json:"correct_answer"`
	Question      string   `json:"question"`
	Answers       []string `json:"answers"`
}

Question holds all the information for each question.

type Questions

type Questions struct {
	Questions QuestionsPacks `json:"questions"`
}

Questions hold all the pack of questions.

func NewQuestions

func NewQuestions() *Questions

NewQuestions reads all the questions from a file, and generates data.

type QuestionsPacks

type QuestionsPacks struct {
	Easy   []Question `json:"easy"`
	Medium []Question `json:"medium"`
	Hard   []Question `json:"hard"`
}

QuestionsPacks holds the question packs depending the difficulty.

type Quiz

type Quiz struct {
	User          *User
	QuestionsPack []Question
}

Quiz holds all the information is needed to start the quiz game.

func NewQuiz

func NewQuiz(user *User) *Quiz

NewQuiz creates a Quiz filled up with all the questions.

type User

type User struct {
	Name       string `json:"name" form:"name" query:"name"`
	Email      string `json:"email" form:"email" query:"email"`
	Difficulty string `json:"difficulty" form:"difficulty" query:"difficulty"`
}

User holds all the information of the player

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL