add nullstore that does absolutely nothing.
This commit is contained in:
2
nullstore/README.md
Normal file
2
nullstore/README.md
Normal 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
32
nullstore/lib.go
Normal 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
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user