summaryrefslogtreecommitdiff
path: root/internal/database/repos/questions.go
blob: d9978a436dd0d112c0f186e0be2256165f3b7c02 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
}