storage

package
v0.0.0-...-0beffce Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const NUM_OF_QUESTIONS = 3283

Variables

This section is empty.

Functions

This section is empty.

Types

type Question

type Question struct {
	Number     int
	Type       string
	Difficulty string
	Prompt     string
	Answer     string
}

Question represents a question with all necessary details.

type QuestionManager

type QuestionManager struct {
	// contains filtered or unexported fields
}

QuestionManager manages available and completed questions using a SQLite database.

func NewQuestionManager

func NewQuestionManager(dbFile string) (*QuestionManager, error)

NewQuestionManager initializes a new QuestionManager and sets up the database.

func (*QuestionManager) AddCompletedQuestion

func (qm *QuestionManager) AddCompletedQuestion(q Question) error

AddCompletedQuestion adds a question to the completed questions table.

func (*QuestionManager) AddQuestion

func (qm *QuestionManager) AddQuestion(q Question) error

AddQuestion adds a new question or updates an existing one in the questions table.

func (*QuestionManager) Close

func (qm *QuestionManager) Close() error

Close closes the database connection.

func (*QuestionManager) DeleteQuestion

func (qm *QuestionManager) DeleteQuestion(number int) error

DeleteQuestion deletes a question from the questions table by its number.

func (*QuestionManager) LoadAllQuestions

func (qm *QuestionManager) LoadAllQuestions() ([]Question, error)

LoadAllQuestions loads all available questions from the database.

func (*QuestionManager) LoadCompletedQuestions

func (qm *QuestionManager) LoadCompletedQuestions() ([]Question, error)

LoadCompletedQuestions loads completed questions from the database.

func (*QuestionManager) LoadQuestion

func (qm *QuestionManager) LoadQuestion(number int) (Question, error)

LoadQuestion retrieves a question by its number from the questions table.

func (*QuestionManager) ShowCompletedQuestionDetails

func (qm *QuestionManager) ShowCompletedQuestionDetails(number int) (Question, error)

ShowCompletedQuestionDetails shows details of a completed question by its number.

Jump to

Keyboard shortcuts

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