This commit is contained in:
parent
d33ed051f4
commit
8f53e8a967
2 changed files with 6 additions and 6 deletions
|
@ -785,13 +785,13 @@ type INotificationDo interface {
|
|||
// Update a given set of notifications to a given viewed state.
|
||||
// State should be a [NotificationViewedStateType]
|
||||
//
|
||||
// UPDATE @@table SET viewed_state = @state WHERE id IN @id
|
||||
// UPDATE @@table SET viewed_state = @state WHERE id IN @ids
|
||||
func (n notificationDo) SetState(state uint8, ids []uint) (err error) {
|
||||
var params []interface{}
|
||||
|
||||
var generateSQL strings.Builder
|
||||
params = append(params, state)
|
||||
params = append(params, id)
|
||||
params = append(params, ids)
|
||||
generateSQL.WriteString("UPDATE notifications SET viewed_state = ? WHERE id IN ? ")
|
||||
|
||||
var executeSQL *gorm.DB
|
||||
|
@ -803,7 +803,7 @@ func (n notificationDo) SetState(state uint8, ids []uint) (err error) {
|
|||
|
||||
// Get the lastest count amount of notifications with a given offset for a user
|
||||
//
|
||||
// SELECT * FROM @@table WHERE for_user_id = @id
|
||||
// SELECT * FROM @@table WHERE for_user_id = @userId
|
||||
// ORDER BY id DESC
|
||||
// {{if count > 0 }}
|
||||
//
|
||||
|
@ -819,7 +819,7 @@ func (n notificationDo) GetLatestWithOffset(userId string, count uint, offset ui
|
|||
var params []interface{}
|
||||
|
||||
var generateSQL strings.Builder
|
||||
params = append(params, id)
|
||||
params = append(params, userId)
|
||||
generateSQL.WriteString("SELECT * FROM notifications WHERE for_user_id = ? ORDER BY id DESC ")
|
||||
if count > 0 {
|
||||
params = append(params, count)
|
||||
|
|
|
@ -25,12 +25,12 @@ type INotification interface {
|
|||
// Update a given set of notifications to a given viewed state.
|
||||
// State should be a [NotificationViewedStateType]
|
||||
//
|
||||
// UPDATE @@table SET viewed_state = @state WHERE id IN @id
|
||||
// UPDATE @@table SET viewed_state = @state WHERE id IN @ids
|
||||
SetState(state uint8, ids ...uint) error
|
||||
|
||||
// Get the lastest count amount of notifications with a given offset for a user
|
||||
//
|
||||
// SELECT * FROM @@table WHERE for_user_id = @id
|
||||
// SELECT * FROM @@table WHERE for_user_id = @userId
|
||||
// ORDER BY id DESC
|
||||
// {{if count > 0 }}
|
||||
// LIMIT @count
|
||||
|
|
Loading…
Reference in a new issue