diff options
Diffstat (limited to 'internal/database/repos/questions.go')
-rw-r--r-- | internal/database/repos/questions.go | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/internal/database/repos/questions.go b/internal/database/repos/questions.go new file mode 100644 index 0000000..d9978a4 --- /dev/null +++ b/internal/database/repos/questions.go @@ -0,0 +1,16 @@ +package repos + +import "demoon/internal/models" + +type QuestionsRepo interface { + DBGetQuestion(id string) (*models.Question, error) +} + +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 +} |