feat: implemented many commands

- added register command
- added reset command
- added users command
- added agg command
- added feeds command
This commit is contained in:
Stevan Freeborn
2026-08-01 14:26:19 -05:00
parent fb53b052b0
commit c012f6008c
14 changed files with 619 additions and 6 deletions
+14
View File
@@ -0,0 +1,14 @@
-- name: CreateFeed :one
INSERT INTO feeds (id, created_at, updated_at, name, url, user_id)
VALUES (
$1,
$2,
$3,
$4,
$5,
$6
)
RETURNING *;
-- name: GetAllFeeds :many
SELECT id, created_at, updated_at, name, url, user_id FROM feeds;
+23
View File
@@ -0,0 +1,23 @@
-- name: CreateUser :one
INSERT INTO users (id, created_at, updated_at, name)
VALUES (
$1,
$2,
$3,
$4
)
RETURNING *;
-- name: GetUserByName :one
SELECT id, created_at, updated_at, name FROM users
WHERE name = $1;
-- name: GetUserById :one
SELECT id, created_at, updated_at, name FROM users
WHERE id = $1;
-- name: GetAllUsers :many
SELECT id, created_at, updated_at, name FROM users;
-- name: DeleteAllUsers :exec
DELETE FROM users;
+13
View File
@@ -0,0 +1,13 @@
-- +goose Up
CREATE TABLE feeds (
id UUID PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
updated_at TIMESTAMP NOT NULL,
name TEXT NOT NULL,
url TEXT UNIQUE NOT NULL,
user_id UUID NOT NULL,
FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE
);
-- +goose Down
DROP TABLE feeds;