models

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

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

Go to latest
Published: Feb 7, 2023 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnswerQuestion

func AnswerQuestion(questionID int, answerID int) (success bool, err error)

func CheckPasswordHash

func CheckPasswordHash(password, hash string) bool

func HashPassword

func HashPassword(password string) (string, error)

Types

type Answer

type Answer struct {
	ID         int    `json:"id,omitempty"`
	Answer     string `json:"answer,omitempty"`
	Correct    bool   `json:"correct,omitempty"`
	QuestionID int    `json:"question_id,omitempty"`
}

type Category

type Category struct {
	ID                  int    `json:"id,omitempty"`
	CategoryName        string `json:"category_name,omitempty"`
	CategoryDescription string `json:"category_description,omitempty"`
}

func ShowCategories

func ShowCategories() (allcategories []Category, err error)

func (*Category) CreateNewCategory

func (c *Category) CreateNewCategory() (err error)

func (*Category) DeleteCategory

func (c *Category) DeleteCategory() (err error)

func (*Category) EditCategory

func (c *Category) EditCategory() (err error)

type Question

type Question struct {
	ID         int      `json:"id,omitempty"`
	Question   string   `json:"question,omitempty"`
	CategoryID int      `json:"category_id,omitempty"`
	Answers    []Answer `json:"answers,omitempty"`
}

func GetAllQuestions

func GetAllQuestions() (allquestions []Question, err error)

func GetRandomQuestionPerCategory

func GetRandomQuestionPerCategory(categoryID int) (randomQuestion Question, err error)

func GetSpecificQuestion

func GetSpecificQuestion(questionID int) (question Question, err error)

func (*Question) CreateNewQuestion

func (q *Question) CreateNewQuestion() (err error)

func (*Question) DeleteQuestion

func (q *Question) DeleteQuestion() (err error)

func (*Question) EditQuestion

func (q *Question) EditQuestion() (err error)

type User

type User struct {
	ID       int    `json:"id,omitempty"`
	Username string `json:"username,omitempty"`
	Password string `json:"password,omitempty"`
}

func GetAllUsers

func GetAllUsers() (allUsers []User, err error)

func (*User) DeleteUser

func (u *User) DeleteUser() (err error)

func (*User) Login

func (u *User) Login() (b bool, err error)

func (*User) Register

func (u *User) Register() (err error)

Jump to

Keyboard shortcuts

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