summaryrefslogtreecommitdiff
path: root/internal/database/repos/questions.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/database/repos/questions.go')
-rw-r--r--internal/database/repos/questions.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/internal/database/repos/questions.go b/internal/database/repos/questions.go
index ab5e093..daf7e16 100644
--- a/internal/database/repos/questions.go
+++ b/internal/database/repos/questions.go
@@ -5,6 +5,7 @@ import "demoon/internal/models"
type QuestionsRepo interface {
DBGetQuestion(id string) (*models.Question, error)
DBGetMixedUbung(id uint32) (*models.MixedUbung, error)
+ DBGetFirst10MixedUbungs() ([]*models.MixedUbung, error)
}
func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) {
@@ -16,6 +17,15 @@ func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) {
return &ubung, nil
}
+func (p *Provider) DBGetFirst10MixedUbungs() ([]*models.MixedUbung, error) {
+ var ubungs []*models.MixedUbung
+ err := p.db.Select(&ubungs, "SELECT * FROM Table_Mixed ORDER BY MixedID LIMIT 10")
+ if err != nil {
+ return nil, err
+ }
+ return ubungs, nil
+}
+
func (p *Provider) DBGetQuestion(id string) (*models.Question, error) {
var question models.Question
err := p.db.Get(&question, "SELECT * FROM questions WHERE id = ?", id)