diff --git a/pkg/mindflow/database/sqlite/db.go b/pkg/mindflow/database/sqlite/db.go index 7388123..189ea71 100644 --- a/pkg/mindflow/database/sqlite/db.go +++ b/pkg/mindflow/database/sqlite/db.go @@ -14,8 +14,6 @@ var ( //go:embed queries/schema.sql querySchema string - //go:embed queries/categoryById.sql - queryCategoryById string //go:embed queries/categoryGetAll.sql queryCategoryGetAll string //go:embed queries/categoryNew.sql @@ -37,7 +35,6 @@ var ( ) var ( - stmtCategoryById *sql.Stmt stmtCategoryGetAll *sql.Stmt stmtCategoryNew *sql.Stmt stmtCategoryEdit *sql.Stmt @@ -57,11 +54,6 @@ func initDBStatements(db *sql.DB) error { return errors.Wrap(err, "failed to init schema") } - stmtCategoryById, err = db.Prepare(queryCategoryById) - if err != nil { - return errors.Wrap(err, "failed to prepare queryCategoryById") - } - stmtCategoryGetAll, err = db.Prepare(queryCategoryGetAll) if err != nil { return errors.Wrap(err, "failed to prepare queryCategoryGetAll") @@ -284,27 +276,6 @@ func (s *SQLiteMindflow) EditCategory(category *mindflow.Category) 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 -} - func (s *SQLiteMindflow) DeleteCategory(id int64) (err error) { tx, err := s.db.Begin() if err != nil { @@ -338,7 +309,6 @@ func (s *SQLiteMindflow) DeleteUnusedCategories() (err error) { } func (s *SQLiteMindflow) Close() error { - stmtCategoryById.Close() stmtCategoryGetAll.Close() stmtCategoryNew.Close() stmtCategoryEdit.Close() diff --git a/pkg/mindflow/mindflow.go b/pkg/mindflow/mindflow.go index ebd98ed..7ad0b7a 100644 --- a/pkg/mindflow/mindflow.go +++ b/pkg/mindflow/mindflow.go @@ -44,7 +44,6 @@ type Mindflow interface { Posts() ([]Post, error) Categories() ([]Category, error) NewCategory(name string) (int64, error) - GetCategoryByID(id int64) (string, error) EditCategory(category *Category) error DeleteCategory(id int64) error DeleteUnusedCategories() error