GetSubscriber in Mongodb
This commit is contained in:
parent
8a29656b9b
commit
86df552bd1
|
@ -154,10 +154,22 @@ func (s MongoDBStorage) UpdateEvent(event Event) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (psql MongoDBStorage) GetSubscriber(subscriber string) ([]Subscription, error) {
|
func (s MongoDBStorage) GetSubscriber(subscriber string) ([]Subscription, error) {
|
||||||
return nil, nil
|
collection := s.Client.Database(s.DbName).Collection(s.Collections["events"])
|
||||||
|
|
||||||
|
filter := bson.M{"namespace": subscriber}
|
||||||
|
|
||||||
|
subscription := []Subscription{}
|
||||||
|
if err := collection.FindOne(context.TODO(), filter).Decode(subscription); err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
return subscription, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (psql MongoDBStorage) GetSubscriptionByUser(subscriber string) ([]Subscription, error) {
|
func (s MongoDBStorage) GetSubscriptionByUser(subscriber string) ([]Subscription, error) {
|
||||||
return nil, nil
|
events, err := s.GetSubscriber(subscriber)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return events, nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue