From eab8cba4bb37491d5c3b497b98faa7029e7b7300 Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Tue, 4 Feb 2025 18:52:57 +0200 Subject: Refactored the way notifications work on the server-side, next commit fixes the client to use this new system --- internal/data/notifications.sql.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 internal/data/notifications.sql.go (limited to 'internal/data/notifications.sql.go') diff --git a/internal/data/notifications.sql.go b/internal/data/notifications.sql.go new file mode 100644 index 0000000..5819438 --- /dev/null +++ b/internal/data/notifications.sql.go @@ -0,0 +1,32 @@ +// Code generated by sqlc. DO NOT EDIT. +// versions: +// sqlc v1.28.0 +// source: notifications.sql + +package data + +import ( + "context" + + "github.com/kyren223/eko/pkg/snowflake" +) + +const setLastReadMessage = `-- name: SetLastReadMessage :exec +INSERT INTO last_read_messages ( + user_id, source_id, last_read +) VALUES (?, ?, ?) +ON CONFLICT DO +UPDATE SET last_read = EXCLUDED.last_read +WHERE user_id = EXCLUDED.user_id AND source_id = EXCLUDED.source_id +` + +type SetLastReadMessageParams struct { + UserID snowflake.ID + SourceID snowflake.ID + LastRead int64 +} + +func (q *Queries) SetLastReadMessage(ctx context.Context, arg SetLastReadMessageParams) error { + _, err := q.db.ExecContext(ctx, setLastReadMessage, arg.UserID, arg.SourceID, arg.LastRead) + return err +} -- cgit v1.3.1