11 lines
413 B
SQL
11 lines
413 B
SQL
-- name: AddLogEntry :exec
|
|
INSERT INTO lock_log (lock, state, code) VALUES (?, ?, ?);
|
|
|
|
-- name: GetLogForLock :many
|
|
SELECT * FROM lock_log WHERE lock = ? ORDER BY timestamp DESC;
|
|
|
|
-- name: GetLogForSlot :many
|
|
SELECT * FROM lock_log WHERE lock = ? AND code = ? ORDER BY timestamp DESC LIMIT 100;
|
|
|
|
-- name: GetLastLogForSlot :many
|
|
SELECT * FROM lock_log WHERE lock = ? AND code = ? ORDER BY timestamp DESC LIMIT 1;
|