backend: can open hint
This commit is contained in:
parent
220c26d9c5
commit
d1c5a545d9
4 changed files with 52 additions and 0 deletions
|
@ -11,6 +11,15 @@ type EHint struct {
|
|||
Cost int64 `json:"cost"`
|
||||
}
|
||||
|
||||
func GetHint(id int64) (EHint, error) {
|
||||
var h EHint
|
||||
if err := DBQueryRow("SELECT id_hint, id_exercice, title, content, cost FROM exercice_hints WHERE id_hint = ?", id).Scan(&h.Id, &h.IdExercice, &h.Title, &h.Content, &h.Cost); err != nil {
|
||||
return h, err
|
||||
}
|
||||
|
||||
return h, nil
|
||||
}
|
||||
|
||||
func (e Exercice) GetHints() ([]EHint, error) {
|
||||
if rows, err := DBQuery("SELECT id_hint, title, content, cost FROM exercice_hints WHERE id_exercice = ?", e.Id); err != nil {
|
||||
return nil, err
|
||||
|
|
Reference in a new issue