ЛР 5 — асинхронная обработка и версии pipeline

This commit is contained in:
2026-11-16 02:38:13 +03:00
parent 276dbdad8a
commit 1f535f1b5b
163 changed files with 17194 additions and 24 deletions
+19
View File
@@ -0,0 +1,19 @@
-- name: CreateMessage :one
INSERT INTO messages (chat_id, sender_id, text)
VALUES ($1, $2, $3)
RETURNING *;
-- name: GetMessagesByChatID :many
SELECT id, chat_id, sender_id, text, created_at
FROM messages
WHERE chat_id = sqlc.arg(chat_id)
AND (
sqlc.narg(after_created_at)::timestamptz IS NULL
OR (created_at, id) >
(sqlc.narg(after_created_at)::timestamptz,
sqlc.narg(after_id)::uuid
)
)
ORDER BY created_at ASC, id ASC
LIMIT sqlc.arg(limit_count);