1
0

Impl. GetCategoryByID().

This commit is contained in:
Alexander Andreev 2023-05-14 04:11:14 +04:00
parent b4ba80e02b
commit 2ffbc17c4f
Signed by: Arav
GPG Key ID: D22A817D95815393

View File

@ -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
}