libfic: add new functions to retrieve the Id of some contents from Title, Label, ...
This commit is contained in:
parent
fbae34ee4f
commit
698c2f1a47
4 changed files with 30 additions and 0 deletions
|
|
@ -127,6 +127,15 @@ func (k FlagKey) GetId() int64 {
|
|||
return k.Id
|
||||
}
|
||||
|
||||
// RecoverId returns the Flag identifier as register in DB.
|
||||
func (k FlagKey) RecoverId() (Flag, error) {
|
||||
if err := DBQueryRow("SELECT id_flag FROM exercice_flags WHERE type LIKE ? AND id_exercice = ?", k.Label, k.IdExercice).Scan(&k.Id); err != nil {
|
||||
return FlagKey{}, err
|
||||
} else {
|
||||
return k, err
|
||||
}
|
||||
}
|
||||
|
||||
// AddFlagKey creates and fills a new struct Flag, from a hashed flag, and registers it into the database.
|
||||
func (k FlagKey) Create(e Exercice) (Flag, error) {
|
||||
// Check the regexp compile
|
||||
|
|
|
|||
Reference in a new issue