diff --git a/pkg/mindflow/database/sqlite/db.go b/pkg/mindflow/database/sqlite/db.go index b73f1be..7a3a8bc 100644 --- a/pkg/mindflow/database/sqlite/db.go +++ b/pkg/mindflow/database/sqlite/db.go @@ -182,3 +182,29 @@ func (s *SQLiteMindflow) GetAll() (posts []mindflow.Post, err error) { defer tx.Rollback() return nil, nil } + +func (s *SQLiteMindflow) NewCategory(name string) (int64, error) { + tx, err := s.db.Begin() + if err != nil { + return 0, err + } + defer tx.Rollback() + + r, err := tx.Stmt(stmtPostNew).Exec(name) + if err != nil { + return 0, err + } + + id, err := r.LastInsertId() + if err != nil { + return 0, err + } + + tx.Commit() + + return id, nil +} + +func (s *SQLiteMindflow) GetCategoryByID(id int64) (string, error) { + return "", nil +}