Documentation ¶
Index ¶
- Constants
- type Question
- type QuestionManager
- func (qm *QuestionManager) AddCompletedQuestion(q Question) error
- func (qm *QuestionManager) AddQuestion(q Question) error
- func (qm *QuestionManager) Close() error
- func (qm *QuestionManager) DeleteQuestion(number int) error
- func (qm *QuestionManager) LoadAllQuestions() ([]Question, error)
- func (qm *QuestionManager) LoadCompletedQuestions() ([]Question, error)
- func (qm *QuestionManager) LoadQuestion(number int) (Question, error)
- func (qm *QuestionManager) ShowCompletedQuestionDetails(number int) (Question, error)
Constants ¶
const NUM_OF_QUESTIONS = 3283
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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.