Documentation ¶
Index ¶
- type Key
- type Notification
- type Notifications
- func (n *Notifications) Delete(ctx context.Context, docID, notificationID primitive.ObjectID) error
- func (n *Notifications) DeleteAll(ctx context.Context, docID primitive.ObjectID) error
- func (n *Notifications) Get(ctx context.Context, docID primitive.ObjectID, skip int, limit int) ([]Notification, error)
- func (n *Notifications) Read(ctx context.Context, docID, notificationID primitive.ObjectID) error
- func (n *Notifications) ReadAll(ctx context.Context, docID primitive.ObjectID) error
- func (n *Notifications) Send(ctx context.Context, item *Notification, documents ...primitive.ObjectID) error
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Notification ¶
type Notification struct { ID primitive.ObjectID `json:"id" bson:"id"` // Поле индекса уведомления, появляется во время агрегации From primitive.ObjectID `json:"from" bson:"from"` // идентифицатор пользователя вызвавшего уведомление Target Target `json:"target" bson:"target"` // ссылка на документ или deeplink Key Key `json:"key" bson:"key"` // ключ уведомления Time time.Time `json:"time" bson:"time"` // время создания уведомления Read bool `json:"read" bson:"read"` // метка прочтения документа }
Структура для добавления уведомления
func CreateNotification ¶
func CreateNotification(from primitive.ObjectID, target Target, key Key) *Notification
Функция для создания уведомления
type Notifications ¶
type Notifications struct {
// contains filtered or unexported fields
}
func NewNotifications ¶
func NewNotifications(collection string, database *mongodata.MongoDB) *Notifications
func (*Notifications) Get ¶
func (n *Notifications) Get(ctx context.Context, docID primitive.ObjectID, skip int, limit int) ([]Notification, error)
Получение списка уведомлений для пользователя
func (*Notifications) Send ¶
func (n *Notifications) Send(ctx context.Context, item *Notification, documents ...primitive.ObjectID) error
Click to show internal directories.
Click to hide internal directories.