From 8f53e8a967c1ac2e40f11734c975341860ff005b Mon Sep 17 00:00:00 2001 From: mstar Date: Fri, 4 Apr 2025 14:06:47 +0200 Subject: [PATCH] Fix another gen definition --- storage-new/dbgen/notifications.gen.go | 8 ++++---- storage-new/models/Notification.go | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/storage-new/dbgen/notifications.gen.go b/storage-new/dbgen/notifications.gen.go index c112467..77a20e3 100644 --- a/storage-new/dbgen/notifications.gen.go +++ b/storage-new/dbgen/notifications.gen.go @@ -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) diff --git a/storage-new/models/Notification.go b/storage-new/models/Notification.go index 9c674ff..3ebb92d 100644 --- a/storage-new/models/Notification.go +++ b/storage-new/models/Notification.go @@ -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