opencode/internal/db/sql/logs.sql

29 lines
389 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,
attributes,
created_at
) 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 = ?
ORDER BY timestamp ASC;
-- name: ListAllLogs :many
SELECT * FROM logs
ORDER BY timestamp DESC
2025-05-13 23:27:09 +08:00
LIMIT ?;