opencode_offline/internal/db/sql/logs.sql

27 lines
367 B
MySQL
Raw Normal View History

2025-05-13 23:27:09 +08:00
-- name: CreateLog :one
2025-05-10 02:37:13 +08:00
INSERT INTO logs (
id,
session_id,
timestamp,
level,
message,
2025-05-14 02:08:43 +08:00
attributes
2025-05-10 02:37:13 +08:00
) VALUES (
?,
?,
?,
?,
?,
?
2025-05-13 23:27:09 +08:00
) RETURNING *;
2025-05-10 02:37:13 +08:00
-- name: ListLogsBySession :many
SELECT * FROM logs
WHERE session_id = ?
2025-05-15 02:06:09 +08:00
ORDER BY timestamp DESC;
2025-05-10 02:37:13 +08:00
-- name: ListAllLogs :many
SELECT * FROM logs
ORDER BY timestamp DESC
2025-05-13 23:27:09 +08:00
LIMIT ?;