lmdb/badger: change (fix?) and simplify queries (offsets and created_at stuff should be simpler and q-dependent).

This commit is contained in:
fiatjaf
2023-11-28 16:04:29 -03:00
parent 348bed02e9
commit b95cfc42cc
8 changed files with 114 additions and 51 deletions

View File

@@ -24,8 +24,9 @@ func (b *BadgerBackend) DeleteEvent(ctx context.Context, evt *nostr.Event) error
prefix := make([]byte, 1+32)
prefix[0] = indexIdPrefix
copy(prefix[1:], id)
opts := badger.DefaultIteratorOptions
opts.PrefetchValues = false
opts := badger.IteratorOptions{
PrefetchValues: false,
}
it := txn.NewIterator(opts)
it.Seek(prefix)
if it.ValidForPrefix(prefix) {