You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
2.3 KiB
Go
50 lines
2.3 KiB
Go
package database
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Question represents a quiz question
|
|
type Question struct {
|
|
ID string `json:"id" db:"id"`
|
|
Theme string `json:"theme" db:"theme"`
|
|
Text string `json:"text" db:"text"`
|
|
Answer string `json:"answer" db:"answer"`
|
|
Hint *string `json:"hint" db:"hint"`
|
|
Difficulty string `json:"difficulty" db:"difficulty"`
|
|
IsActive bool `json:"is_active" db:"is_active"`
|
|
CreatedAt time.Time `json:"created_at" db:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
|
|
}
|
|
|
|
// GameSession represents a game session
|
|
type GameSession struct {
|
|
ID string `json:"id" db:"id"`
|
|
PlayerName string `json:"player_name" db:"player_name"`
|
|
UserID *string `json:"user_id" db:"user_id"`
|
|
TotalScore int `json:"total_score" db:"total_score"`
|
|
QuestionsAsked int `json:"questions_asked" db:"questions_asked"`
|
|
QuestionsCorrect int `json:"questions_correct" db:"questions_correct"`
|
|
HintsUsed int `json:"hints_used" db:"hints_used"`
|
|
StartTime time.Time `json:"start_time" db:"start_time"`
|
|
EndTime *time.Time `json:"end_time" db:"end_time"`
|
|
Status string `json:"status" db:"status"`
|
|
CurrentQuestionID *string `json:"current_question_id" db:"current_question_id"`
|
|
CurrentAttempts int `json:"current_attempts" db:"current_attempts"`
|
|
SessionData *string `json:"session_data" db:"session_data"`
|
|
}
|
|
|
|
// QuestionAttempt represents an attempt at answering a question
|
|
type QuestionAttempt struct {
|
|
ID string `json:"id" db:"id"`
|
|
SessionID string `json:"session_id" db:"session_id"`
|
|
QuestionID string `json:"question_id" db:"question_id"`
|
|
AttemptNumber int `json:"attempt_number" db:"attempt_number"`
|
|
SubmittedAnswer string `json:"submitted_answer" db:"submitted_answer"`
|
|
IsCorrect bool `json:"is_correct" db:"is_correct"`
|
|
UsedHint bool `json:"used_hint" db:"used_hint"`
|
|
PointsAwarded int `json:"points_awarded" db:"points_awarded"`
|
|
SubmittedAt time.Time `json:"submitted_at" db:"submitted_at"`
|
|
TimeTakenMs int64 `json:"time_taken_ms" db:"time_taken_ms"`
|
|
Metadata *string `json:"metadata" db:"metadata"`
|
|
} |