notifications

package
v0.14.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Key

type Key string

Ключ для уведомления

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) Delete

func (n *Notifications) Delete(ctx context.Context, docID, notificationID primitive.ObjectID) error

func (*Notifications) DeleteAll

func (n *Notifications) DeleteAll(ctx context.Context, docID primitive.ObjectID) error

func (*Notifications) Get

func (n *Notifications) Get(ctx context.Context, docID primitive.ObjectID, skip int, limit int) ([]Notification, error)

Получение списка уведомлений для пользователя

func (*Notifications) Read

func (n *Notifications) Read(ctx context.Context, docID, notificationID primitive.ObjectID) error

Установка метки о прочтении уведомления

func (*Notifications) ReadAll

func (n *Notifications) ReadAll(ctx context.Context, docID primitive.ObjectID) error

func (*Notifications) Send

func (n *Notifications) Send(ctx context.Context, item *Notification, documents ...primitive.ObjectID) error

type Target

type Target string

идентификатор на который ссылается документ

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL