Impl. GetCategoryByID().
This commit is contained in:
parent
b4ba80e02b
commit
2ffbc17c4f
@ -205,6 +205,23 @@ func (s *SQLiteMindflow) NewCategory(name string) (int64, error) {
|
||||
return id, nil
|
||||
}
|
||||
|
||||
func (s *SQLiteMindflow) GetCategoryByID(id int64) (string, error) {
|
||||
return "", nil
|
||||
func (s *SQLiteMindflow) GetCategoryByID(id int64) (name string, err error) {
|
||||
tx, err := s.db.Begin()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
defer tx.Rollback()
|
||||
|
||||
r := tx.Stmt(stmtCategoryById).QueryRow(id)
|
||||
if r.Err() != nil {
|
||||
return "", r.Err()
|
||||
}
|
||||
|
||||
if err := r.Scan(name); err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
tx.Commit()
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user