summaryrefslogtreecommitdiff
path: root/internal/data/notifications.sql.go
blob: 581943891c25b79391bc4e3eb3e157df7098979b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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
}