From 8bc7544e8933d64abc2610a265f37fe13b5767d5 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 5 Apr 2025 15:04:15 +0300 Subject: Feat: question repo --- internal/database/repos/questions.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 internal/database/repos/questions.go (limited to 'internal/database/repos/questions.go') 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 +} -- cgit v1.2.3