gostart/queries.sql

93 lines
1.7 KiB
MySQL
Raw Permalink Normal View History

2022-11-29 19:55:00 -07:00
-- name: AddOwner :one
insert into owners (id, name, show_shared)
values (?, ?, ?) returning *;
2022-11-29 19:55:00 -07:00
-- name: GetOwner :one
select *
from owners
where id = ?;
-- name: GetAllWatchItems :many
select *
from watch_items;
-- name: GetAllWatchItemsByOwner :many
select *
from watch_items
where owner_id = ?;
-- name: AddWatchItem :one
2022-12-02 20:53:05 -07:00
insert into watch_items (owner_id, name, repo)
values (?, ?, ?) returning *;
2022-11-29 19:55:00 -07:00
-- name: DeleteWatchItem :exec
2022-11-29 20:47:23 -07:00
delete
from watch_items
where id = ?
and owner_id = ?;
2022-11-29 19:55:00 -07:00
2022-12-02 20:53:05 -07:00
-- name: GetAllLinksForOwner :many
2022-11-29 19:55:00 -07:00
select *
from links
where owner_id = ?
or shared = true;
2022-11-29 19:55:00 -07:00
2022-12-02 20:53:05 -07:00
-- name: GetAllLinks :many
select *
from links;
2022-11-29 19:55:00 -07:00
-- name: AddLink :one
2022-12-21 19:21:40 -07:00
insert into links (owner_id, url, name, logo_url, shared)
values (?, ?, ?, ?, ?) returning *;
2022-11-29 19:55:00 -07:00
2022-12-05 15:45:39 -07:00
-- name: GetLinkByID :one
select *
from links
where id = ?;
2022-12-05 15:45:39 -07:00
2022-11-29 19:55:00 -07:00
-- name: DeleteLink :exec
2022-11-29 20:47:23 -07:00
delete
from links
where id = ?
and owner_id = ?;
2022-11-29 19:55:00 -07:00
-- name: GetAllIcons :many
select *
from icons
where owner_id = ?;
2022-12-02 20:53:05 -07:00
-- name: GetIconByLinkID :one
select *
from icons
2022-12-24 05:50:23 -07:00
where link_id = ?;
2022-12-02 20:53:05 -07:00
-- name: AddIcon :exec
insert
into icons (owner_id, link_id, content_type, data)
values (?, ?, ?, ?) on conflict(link_id) do
update set data = excluded.data, content_type = excluded.content_type;
2022-11-29 19:55:00 -07:00
-- name: GetAllPullRequests :many
select *
from pull_requests
where owner_id = ?;
2022-11-29 19:55:00 -07:00
-- name: AddPullRequest :one
insert into pull_requests (owner_id, number, repo, description, url)
values (?, ?, ?, ?, ?) returning *;
2022-11-29 19:55:00 -07:00
-- name: DeletePullRequest :exec
2022-11-29 20:47:23 -07:00
delete
from pull_requests
where id = ?
and owner_id = ?;
2022-11-29 19:55:00 -07:00
-- name: GetAllPullRequestIgnores :many
select *
from pull_request_ignores
where owner_id = ?;
-- name: AddPullRequestIgnore :one
insert into pull_request_ignores (owner_id, number, repo)
values (?, ?, ?) returning *;