models

package
v0.0.0-...-1ddc2b5 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option struct {
	gorm.Model
	Text       string   `gorm:"type:TEXT;not null;index"`
	IsCorrect  bool     `gorm:"not null;default:false"`
	QuestionID uint     `gorm:"not null"`
	Question   Question `gorm:"foreignKey:QuestionID;references:ID;constraint:OnDelete:CASCADE"`
}

type Question

type Question struct {
	gorm.Model
	Text   string `gorm:"type:TEXT;not null;index"`
	QuizID uint   `gorm:"not null"`
	Quiz   Quiz   `gorm:"foreignKey:QuizID;references:ID;constraint:OnDelete:CASCADE"`
}

type Quiz

type Quiz struct {
	gorm.Model
	Title       string `gorm:"type:varchar(255);not null;index"`
	Description string `gorm:"type:TEXT;not null"`
}

type QuizResult

type QuizResult struct {
	ID          uint      `gorm:"primaryKey;auto_increment"`
	Score       int       `gorm:"not null"`
	SubmittedAt time.Time `gorm:"default:CURRENT_TIMESTAMP"`
	QuizID      uint      `gorm:"not null"`
	UserID      uint      `gorm:"not null"`
	Quiz        Quiz      `gorm:"foreignKey:QuizID;references:ID;constraint:OnDelete:CASCADE"`
	User        User      `gorm:"foreignKey:UserID;references:ID;constraint:OnDelete:CASCADE"`
}

type QuizResultDetail

type QuizResultDetail struct {
	ID         uint     `gorm:"primaryKey;auto_increment"`
	QuizID     uint     `gorm:"not null"`
	QuestionID uint     `gorm:"not null"`
	OptionID   uint     `gorm:"not null"`
	Quiz       Quiz     `gorm:"foreignKey:QuizID;references:ID;constraint:OnDelete:CASCADE"`
	Question   Question `gorm:"foreignKey:QuestionID;references:ID;constraint:OnDelete:CASCADE"`
	Option     Option   `gorm:"foreignKey:OptionID;references:ID;constraint:OnDelete:CASCADE"`
}

type User

type User struct {
	gorm.Model
	Name  string `gorm:"type:varchar(255);not null"`
	Email string `gorm:"type:varchar(255);not null;index"`
}

Jump to

Keyboard shortcuts

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