notifications

package
v0.0.0-...-b84af7b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BuffersLength = 10

How much capacity each of the incoming notifications channels will have.

View Source
const PoolSize = 4

Variables

View Source
var (
	Transmit chan Socket
	Database chan Notification
)

Define pool of channels.

View Source
var NotificationNotFound = errors.New("Notification has not been found by given criteria.")

Functions

func SomeoneCommentedYourCommentEmail

func SomeoneCommentedYourCommentEmail(p post.Post, comment comments.Comment, usr user.User) (*gomail.Message, error)

SomeoneCommentedYourCommentEmail notification constructor.

func SomeoneCommentedYourPostEmail

func SomeoneCommentedYourPostEmail(p post.Post, usr user.User) (*gomail.Message, error)

SomeoneCommentedYourPostEmail notification constructor.

func UserID

func UserID(id bson.ObjectId, take, skip int) common.Query

Types

type Deps

type Deps interface {
	Mgo() *mgo.Database
	Log() *logging.Logger
	S3() *s3.Bucket
	LedisDB() *ledis.DB
}

type Notification

type Notification struct {
	Id        bson.ObjectId   `bson:"_id,omitempty" json:"id,omitempty"`
	UserId    bson.ObjectId   `bson:"user_id" json:"user_id"`
	Type      string          `bson:"type" json:"type"`
	RelatedId bson.ObjectId   `bson:"related_id" json:"related_id"`
	Users     []bson.ObjectId `bson:"users" json:"users"`
	Seen      bool            `bson:"seen" json:"seen"`
	Created   time.Time       `bson:"created_at" json:"created_at"`
	Updated   time.Time       `bson:"updated_at" json:"updated_at"`
}

func FindId

func FindId(deps Deps, id bson.ObjectId) (notification Notification, err error)

type Notifications

type Notifications []Notification

func FetchBy

func FetchBy(deps Deps, query common.Query) (list Notifications, err error)

Fetch multiple leads by conditions

func (Notifications) CommentsScope

func (all Notifications) CommentsScope() common.Scope

func (Notifications) Humanize

func (all Notifications) Humanize(deps Deps) (list []map[string]interface{}, err error)

func (Notifications) UsersScope

func (all Notifications) UsersScope() common.Scope

type Socket

type Socket struct {
	Chan   string                 `json:"c"`
	Action string                 `json:"action"`
	Params map[string]interface{} `json:"p"`
}

Jump to

Keyboard shortcuts

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