summaryrefslogtreecommitdiff
path: root/pkg/database
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/database')
-rw-r--r--pkg/database/states.go14
1 files changed, 11 insertions, 3 deletions
diff --git a/pkg/database/states.go b/pkg/database/states.go
index e848924..46a5536 100644
--- a/pkg/database/states.go
+++ b/pkg/database/states.go
@@ -5,9 +5,17 @@ import (
"fmt"
)
-func (db *DB) DeleteState(name string) error {
- _, err := db.Exec(`DELETE FROM states WHERE name = ?;`, name)
- return err
+// returns true in case of successful deletion
+func (db *DB) DeleteState(name string) (bool, error) {
+ result, err := db.Exec(`DELETE FROM states WHERE name = ?;`, name)
+ if err != nil {
+ return false, err
+ }
+ n, err := result.RowsAffected()
+ if err != nil {
+ return false, err
+ }
+ return n == 1, nil
}
func (db *DB) GetState(name string) ([]byte, error) {