-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathendpoints.sql
More file actions
62 lines (54 loc) · 1.06 KB
/
endpoints.sql
File metadata and controls
62 lines (54 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
-- name: CreateEndpoint :one
INSERT INTO endpoints (
collection_id,
name,
method,
url,
headers,
query_params,
request_body
) VALUES (
?, ?, ?, ?, ?, ?, ?
)
RETURNING *;
-- name: GetEndpoint :one
SELECT * FROM endpoints
WHERE id = ? LIMIT 1;
-- name: ListEndpointsByCollection :many
SELECT * FROM endpoints
WHERE collection_id = ?
ORDER BY created_at DESC;
-- name: ListEndpointsPaginated :many
SELECT * FROM endpoints
WHERE collection_id = ?
ORDER BY name
LIMIT ? OFFSET ?;
-- name: CountEndpointsByCollection :one
SELECT COUNT(*) FROM endpoints
WHERE collection_id = ?;
-- name: GetEndpointCountsByCollections :many
SELECT collection_id, COUNT(*) as count
FROM endpoints
GROUP BY collection_id;
-- name: UpdateEndpointName :one
UPDATE endpoints
SET
name = ?
WHERE
id = ?
RETURNING *;
-- name: UpdateEndpoint :one
UPDATE endpoints
SET
name = ?,
method = ?,
url = ?,
headers = ?,
query_params = ?,
request_body = ?
WHERE
id = ?
RETURNING *;
-- name: DeleteEndpoint :exec
DELETE FROM endpoints
WHERE id = ?;