Documentation ¶
Index ¶
Constants ¶
View Source
const ( AFriendRequest Action = "friendrequest" AFriendAccept = "friendaccept" AUserTag = "usertag" ALike = "like" AComment = "comment" AEventUpdate = "eventupdate" )
Variables ¶
Functions ¶
func BulkNotify ¶
func BulkNotify(userID string, b BulkNotifier, db *gorm.DB)
Types ¶
type BulkNotifier ¶
type Notification ¶
type Notification struct { ID string `json:"id" gorm:"primary_key" sql:"type:uuid;default:uuid_generate_v4()"` UserID string `json:"user_id" sql:"type:uuid"` // ID of first user ToID string `json:"to_id" sql:"type:uuid"` // ID of second user RecordID string `json:"record_id"` RecordType string `json:"record_type"` Action Action `json:"action"` Read bool `json:"read"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` User users.User `json:"user" sql:"-"` }
func New ¶
func New(userID, toID string, r Notifier) (n Notification, errs models.ValidationErrors)
func NewBulk ¶
func NewBulk(userID string, b BulkNotifier) (ns []Notification, errs models.ValidationErrors)
func (Notification) NewPushNotification ¶
func (n Notification) NewPushNotification(db *gorm.DB) (PushNotification, error)
func (*Notification) Validate ¶
func (n *Notification) Validate() (errs models.ValidationErrors)
type Notifications ¶
type Notifications []Notification
func ListByUserID ¶
func ListByUserID(userID string, db *gorm.DB) (ns Notifications, err error)
func (*Notifications) CollectUsers ¶
func (ns *Notifications) CollectUsers(db *gorm.DB)
type PushNotification ¶
type PushNotification struct { DeviceToken string Message string Action string Meta map[string]interface{} NotificationID string }
func (PushNotification) Prepare ¶
func (n PushNotification) Prepare() apns.Notification
Click to show internal directories.
Click to hide internal directories.