summaryrefslogtreecommitdiff
path: root/pkg/database
diff options
context:
space:
mode:
authorJulien Dessaux2024-10-02 08:26:53 +0200
committerJulien Dessaux2024-10-02 23:23:46 +0200
commit8949cee8b3f561397202246dd7cc7617d7dc2999 (patch)
tree1ad55af185feffdb14670692297b1eb6d0f4b6c7 /pkg/database
parentfeat(tfstated): add json encoding and decoding helpers (diff)
downloadtfstated-8949cee8b3f561397202246dd7cc7617d7dc2999.tar.gz
tfstated-8949cee8b3f561397202246dd7cc7617d7dc2999.tar.bz2
tfstated-8949cee8b3f561397202246dd7cc7617d7dc2999.zip
feat(tfstated): implement DELETE method
Diffstat (limited to '')
-rw-r--r--pkg/database/states.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/pkg/database/states.go b/pkg/database/states.go
index ef2263b..3a0b0b9 100644
--- a/pkg/database/states.go
+++ b/pkg/database/states.go
@@ -4,6 +4,11 @@ import (
"database/sql"
)
+func (db *DB) DeleteState(name string) error {
+ _, err := db.Exec(`DELETE FROM states WHERE name = ?;`, name)
+ return err
+}
+
func (db *DB) GetState(name string) ([]byte, error) {
var encryptedData []byte
err := db.QueryRow(`SELECT data FROM states WHERE name = ?;`, name).Scan(&encryptedData)