|
1 | | --- name: CreateTransaction :one |
| 1 | +-- name: StoreTransactionPQ :one |
2 | 2 | INSERT INTO transactions_archive ( |
3 | | - id, session_id, status, output, created_at |
| 3 | + id, session_id, action, resource, permissions, status, error, output, created_at |
4 | 4 | ) VALUES ( |
5 | | - $1, $2, $3, $4, $5 |
| 5 | + $1, $2, $3, $4, $5, $6, $7, $8, $9 |
6 | 6 | ) RETURNING *; |
7 | 7 |
|
8 | | --- name: GetTransaction :one |
| 8 | +-- name: GetTransactionPQ :one |
9 | 9 | SELECT * FROM transactions_archive |
10 | 10 | WHERE id = $1; |
11 | 11 |
|
12 | | --- name: GetTransactionsBySession :many |
| 12 | +-- name: GetTransactionsBySessionPQ :many |
13 | 13 | SELECT * FROM transactions_archive |
14 | 14 | WHERE session_id = $1 |
15 | 15 | ORDER BY created_at DESC; |
16 | 16 |
|
17 | | --- name: GetSuccessfulTransactions :many |
| 17 | +-- name: GetSuccessfulTransactionsPQ :many |
18 | 18 | SELECT * FROM transactions_archive |
19 | 19 | WHERE session_id = $1 AND status = 'success' |
20 | 20 | ORDER BY created_at DESC; |
21 | 21 |
|
22 | | --- name: GetFailedTransactions :many |
23 | | -SELECT * FROM transactions_archive |
24 | | -WHERE session_id = $1 AND status = 'failure' |
25 | | -ORDER BY created_at DESC; |
| 22 | +-- name: GetFailedTransactionsPQ :many |
| 23 | +select * from transactions_archive |
| 24 | +where session_id = $1 and status = 'failure' |
| 25 | +order by created_at desc; |
| 26 | + |
| 27 | +-- name: GetPendingTransactionsPQ :many |
| 28 | +select * from transactions_archive |
| 29 | +where session_id = $1 and status = 'pending' |
| 30 | +order by created_at desc; |
26 | 31 |
|
27 | | --- name: DeleteTransaction :exec |
| 32 | +-- name: DeleteTransactionPQ :exec |
28 | 33 | DELETE FROM transactions_archive WHERE id = $1; |
29 | 34 |
|
30 | | --- name: DeleteTransactionsBySession :exec |
| 35 | +-- name: DeleteTransactionsBySessionPQ :exec |
31 | 36 | DELETE FROM transactions_archive WHERE session_id = $1; |
32 | 37 |
|
33 | | --- name: CountTransactionsByStatus :one |
| 38 | +-- name: CountTransactionsByStatusPQ :one |
34 | 39 | SELECT COUNT(*) FROM transactions_archive |
35 | 40 | WHERE session_id = $1 AND status = $2; |
0 commit comments