summaryrefslogtreecommitdiff
path: root/internal/database
diff options
context:
space:
mode:
Diffstat (limited to 'internal/database')
-rw-r--r--internal/database/sql/main.go9
1 files changed, 9 insertions, 0 deletions
diff --git a/internal/database/sql/main.go b/internal/database/sql/main.go
index 6ca8879..0ac81a6 100644
--- a/internal/database/sql/main.go
+++ b/internal/database/sql/main.go
@@ -36,6 +36,15 @@ type DB struct {
URI string
}
+func (d *DB) DBGetQuestion(id string) (*models.Question, error) {
+ var question models.Question
+ err := d.Conn.Get(&question, "SELECT * FROM questions WHERE id = ?", id)
+ if err != nil {
+ return nil, err
+ }
+ return &question, nil
+}
+
func (d *DB) CloseAll() error {
for _, conn := range []*sqlx.DB{d.Conn} {
if err := closeConn(conn); err != nil {