summaryrefslogtreecommitdiff
path: root/internal/database/repos/questions.go
blob: 67f9d1f667bb0f1388090058ab062b91044a6506 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
package repos

import "demoon/internal/models"

type QuestionsRepo interface {
	DBGetQuestion(id string) (*models.Question, error)
	DBGetMixedUbung(id uint32) (*models.MixedUbung, error) // implemet; ai!
}

func (p *Provider) DBGetQuestion(id string) (*models.Question, error) {
	var question models.Question
	err := p.db.Get(&question, "SELECT * FROM questions WHERE id = ?", id)
	if err != nil {
		return nil, err
	}
	return &question, nil
}