diff options
Diffstat (limited to 'models/persister.go')
-rw-r--r-- | models/persister.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/persister.go b/models/persister.go index c6e0c72..5f79e4e 100644 --- a/models/persister.go +++ b/models/persister.go @@ -43,6 +43,16 @@ func (p *Persister) Store(model model) error { return err } +func (p *Persister) Delete(model model) error { + log := p.log.With("model", model.Name()).With("DedupKey", model.DedupKey()).With("Key", model.Key()) + log.Debug("Delete()") + err := p.db.Update(func(txn *badger.Txn) error { + txn.Delete([]byte(model.Key())) + return nil + }) + return err +} + func (p *Persister) Count(model model) (int, error) { opts := badger.DefaultIteratorOptions opts.PrefetchValues = false |