notification

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollectionName = "notification"
)

Variables

This section is empty.

Functions

func MakeBsonFilter

func MakeBsonFilter(options *FilterOptions) bson.M

Types

type FilterOptions

type FilterOptions struct {
	OnlyUserId *string
	OnlyType   *int64
	OnlyStatus *int64
}

type INotificationMongoMapper

type INotificationMongoMapper interface {
	GetNotifications(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Notification, error)
	Count(ctx context.Context, fopts *FilterOptions) (int64, error)
	UpdateNotifications(ctx context.Context, fopts *FilterOptions) error
	DeleteNotifications(ctx context.Context, fopts *FilterOptions) error
	InsertOne(ctx context.Context, data *Notification) error
	GetNotificationsAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Notification, int64, error)
}

func NewNotificationModel

func NewNotificationModel(config *config.Config) INotificationMongoMapper

type MongoFilter

type MongoFilter struct {
	*FilterOptions
	// contains filtered or unexported fields
}

func (*MongoFilter) CheckOnlyIsRead

func (f *MongoFilter) CheckOnlyIsRead()

func (*MongoFilter) CheckOnlyType

func (f *MongoFilter) CheckOnlyType()

func (*MongoFilter) CheckOnlyUserId

func (f *MongoFilter) CheckOnlyUserId()

type MongoMapper

type MongoMapper struct {
	// contains filtered or unexported fields
}

func (*MongoMapper) Count

func (m *MongoMapper) Count(ctx context.Context, fopts *FilterOptions) (int64, error)

func (*MongoMapper) DeleteNotifications

func (m *MongoMapper) DeleteNotifications(ctx context.Context, fopts *FilterOptions) error

func (*MongoMapper) GetNotifications

func (m *MongoMapper) GetNotifications(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Notification, error)

func (*MongoMapper) GetNotificationsAndCount

func (m *MongoMapper) GetNotificationsAndCount(ctx context.Context, fopts *FilterOptions, popts *pagination.PaginationOptions, sorter mongop.MongoCursor) ([]*Notification, int64, error)

func (*MongoMapper) InsertOne added in v1.0.6

func (m *MongoMapper) InsertOne(ctx context.Context, data *Notification) error

func (*MongoMapper) UpdateNotifications

func (m *MongoMapper) UpdateNotifications(ctx context.Context, fopts *FilterOptions) error

type Notification

type Notification struct {
	ID              primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
	TargetUserId    string             `bson:"targetUserId,omitempty" json:"targetUserId,omitempty"`
	SourceUserId    string             `bson:"sourceUserId,omitempty" json:"sourceUserId,omitempty"`
	SourceContentId string             `bson:"sourceContentId,omitempty" json:"sourceContentId,omitempty"`
	Type            int64              `bson:"type,omitempty" json:"type,omitempty"`
	TargetType      int64              `bson:"targetType,omitempty" json:"targetType,omitempty"`
	Text            string             `bson:"text,omitempty" json:"text,omitempty"`
	CreateAt        time.Time          `bson:"createAt,omitempty" json:"createAt,omitempty"`
	UpdateAt        time.Time          `bson:"updateAt,omitempty" json:"updateAt,omitempty"`
	Status          int64              `bson:"status,omitempty" json:"status,omitempty"`
}

Jump to

Keyboard shortcuts

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