Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DocumentLike ¶
type DocumentLike interface {
GetId() string
}
type FindByObjectId ¶
type FindByObjectId[D DocumentLike] func(store map[string]D, id primitive.ObjectID) (string, D)
type Handler ¶
type Handler[D DocumentLike] interface { OnInserted(doc D) OnUpdated(doc D) OnDeleted(key string, doc D) }
type MongoKVStore ¶
type MongoKVStore[D DocumentLike] struct { UseStore bool Handler Handler[D] NewDocument NewDocument[D] FindByObjectId FindByObjectId[D] Lock sync.RWMutex Store map[string]D // contains filtered or unexported fields }
func NewMongoKVStore ¶
func NewMongoKVStore[D DocumentLike]() *MongoKVStore[D]
func (*MongoKVStore[D]) Start ¶
func (s *MongoKVStore[D]) Start(ctx context.Context, collection *mongo.Collection) error
func (*MongoKVStore[D]) Stop ¶
func (s *MongoKVStore[D]) Stop()
type NewDocument ¶
type NewDocument[D DocumentLike] func() D
Click to show internal directories.
Click to hide internal directories.