diff --git a/nullstore/README.md b/nullstore/README.md new file mode 100644 index 0000000..8f9673d --- /dev/null +++ b/nullstore/README.md @@ -0,0 +1,2 @@ +`nullstore` is an eventstore that doesn't actually do anything. +It doesn't store anything, it doesn't return anything. diff --git a/nullstore/lib.go b/nullstore/lib.go new file mode 100644 index 0000000..2d6b8b2 --- /dev/null +++ b/nullstore/lib.go @@ -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 +}