From 23d76dcea22d4ce28b356f7ebfad4e1af6f800af Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Sun, 5 Nov 2023 10:40:34 -0300 Subject: [PATCH] add nullstore that does absolutely nothing. --- nullstore/README.md | 2 ++ nullstore/lib.go | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 nullstore/README.md create mode 100644 nullstore/lib.go 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 +}