MCPcopy Create free account
hub / github.com/gotify/server / GetMessagesByUserSince

Method GetMessagesByUserSince

database/message.go:39–51  ·  view source on GitHub ↗

GetMessagesByUserSince returns limited messages from a user. If since is 0 it will be ignored.

(userID uint, limit int, since uint)

Source from the content-addressed store, hash-verified

37// GetMessagesByUserSince returns limited messages from a user.
38// If since is 0 it will be ignored.
39func (d *GormDatabase) GetMessagesByUserSince(userID uint, limit int, since uint) ([]*model.Message, error) {
40 var messages []*model.Message
41 db := d.DB.Joins("JOIN applications ON applications.user_id = ?", userID).
42 Where("messages.application_id = applications.id").Order("messages.id desc").Limit(limit)
43 if since != 0 {
44 db = db.Where("messages.id < ?", since)
45 }
46 err := db.Find(&messages).Error
47 if err == gorm.ErrRecordNotFound {
48 err = nil
49 }
50 return messages, err
51}
52
53// GetMessagesByApplication returns all messages from an application.
54func (d *GormDatabase) GetMessagesByApplication(tokenID uint) ([]*model.Message, error) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected