aboutsummaryrefslogtreecommitdiffstats
path: root/pkg/database/query/calendars.sql
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/database/query/calendars.sql')
-rw-r--r--pkg/database/query/calendars.sql23
1 files changed, 23 insertions, 0 deletions
diff --git a/pkg/database/query/calendars.sql b/pkg/database/query/calendars.sql
new file mode 100644
index 0000000..490475d
--- /dev/null
+++ b/pkg/database/query/calendars.sql
@@ -0,0 +1,23 @@
+-- name: CreateCalendar :one
+INSERT INTO calendars (
+ user_id, name, key
+) VALUES (
+ $1, $2, $3
+)
+RETURNING *;
+
+-- name: GetCalendarForUser :one
+SELECT * FROM calendars
+WHERE user_id = $1 LIMIT 1;
+
+-- name: GetCalendarByName :one
+SELECT * FROM calendars
+WHERE name = $1 LIMIT 1;
+
+-- name: DeleteCalendar :execrows
+DELETE FROM calendars
+WHERE user_id = $1;
+
+-- name: DeleteCalendarByName :execrows
+DELETE FROM calendars
+WHERE name = $1;