diff options
author | Julien Dessaux | 2024-10-02 08:26:53 +0200 |
---|---|---|
committer | Julien Dessaux | 2024-10-02 23:23:46 +0200 |
commit | 8949cee8b3f561397202246dd7cc7617d7dc2999 (patch) | |
tree | 1ad55af185feffdb14670692297b1eb6d0f4b6c7 /pkg/database | |
parent | feat(tfstated): add json encoding and decoding helpers (diff) | |
download | tfstated-8949cee8b3f561397202246dd7cc7617d7dc2999.tar.gz tfstated-8949cee8b3f561397202246dd7cc7617d7dc2999.tar.bz2 tfstated-8949cee8b3f561397202246dd7cc7617d7dc2999.zip |
feat(tfstated): implement DELETE method
Diffstat (limited to 'pkg/database')
-rw-r--r-- | pkg/database/states.go | 5 |
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) |