From 1267727b4af0f1e61ad4e24c6f98b1da29f6e7cc Mon Sep 17 00:00:00 2001 From: Ryan G <78384369+SpongeManiac@users.noreply.github.com> Date: Fri, 16 Jun 2023 09:49:09 -0700 Subject: [PATCH] Added Select Single Query --- src/invidious/database/sessions.cr | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/invidious/database/sessions.cr b/src/invidious/database/sessions.cr index 96587082..e5d74f24 100644 --- a/src/invidious/database/sessions.cr +++ b/src/invidious/database/sessions.cr @@ -62,6 +62,15 @@ module Invidious::Database::SessionIDs PG_DB.query_one?(request, sid, as: String) end + def select_one(sid : String) : {session: String, issued: Time}? + request = <<-SQL + SELECT id, issued FROM session_ids + WHERE id = $1 + SQL + + PG_DB.query_one?(request, sid, as: {session: String, issued: Time}) + end + def select_all(email : String) : Array({session: String, issued: Time}) request = <<-SQL SELECT id, issued FROM session_ids