diff options
author | Grail Finder (aider) <wohilas@gmail.com> | 2025-04-06 09:13:51 +0300 |
---|---|---|
committer | Grail Finder (aider) <wohilas@gmail.com> | 2025-04-06 09:13:51 +0300 |
commit | b5343e90084f6bc8934065f16ef1167320791050 (patch) | |
tree | 6241594e28131be8f1fdd9698f10d71a90e5031e | |
parent | de9367030b8089a5cb0cc129e889b6012c668e19 (diff) |
feat: implement DBGetMixedUbung method
-rw-r--r-- | internal/database/repos/questions.go | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/internal/database/repos/questions.go b/internal/database/repos/questions.go index 67f9d1f..f444b05 100644 --- a/internal/database/repos/questions.go +++ b/internal/database/repos/questions.go @@ -4,7 +4,16 @@ import "demoon/internal/models" type QuestionsRepo interface { DBGetQuestion(id string) (*models.Question, error) - DBGetMixedUbung(id uint32) (*models.MixedUbung, error) // implemet; ai! + DBGetMixedUbung(id uint32) (*models.MixedUbung, error) +} + +func (p *Provider) DBGetMixedUbung(id uint32) (*models.MixedUbung, error) { + var ubung models.MixedUbung + err := p.db.Get(&ubung, "SELECT * FROM mixed_ubungs WHERE mixed_id = ?", id) + if err != nil { + return nil, err + } + return &ubung, nil } func (p *Provider) DBGetQuestion(id string) (*models.Question, error) { |