add nullstore that does absolutely nothing.

This commit is contained in:
fiatjaf
2023-11-05 10:40:34 -03:00
parent 027ad0738d
commit 23d76dcea2
2 changed files with 34 additions and 0 deletions

2
nullstore/README.md Normal file
View File

@@ -0,0 +1,2 @@
`nullstore` is an eventstore that doesn't actually do anything.
It doesn't store anything, it doesn't return anything.

32
nullstore/lib.go Normal file
View File

@@ -0,0 +1,32 @@
package nullstore
import (
"context"
"github.com/fiatjaf/eventstore"
"github.com/nbd-wtf/go-nostr"
)
var _ eventstore.Store = (*NullStore)(nil)
type NullStore struct{}
func (b *NullStore) Init() error {
return nil
}
func (b NullStore) Close() {}
func (b NullStore) DeleteEvent(ctx context.Context, evt *nostr.Event) error {
return nil
}
func (b NullStore) QueryEvents(ctx context.Context, filter nostr.Filter) (chan *nostr.Event, error) {
ch := make(chan *nostr.Event)
close(ch)
return ch, nil
}
func (b NullStore) SaveEvent(ctx context.Context, evt *nostr.Event) error {
return nil
}