blob: 03749473091a2abeac303ffb6d11812acb2fe029 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
require "./base.cr"
module Invidious::Database::Annotations
extend self
def insert(id : String, annotations : String)
request = <<-SQL
INSERT INTO annotations
VALUES ($1, $2)
ON CONFLICT DO NOTHING
SQL
PG_DB.exec(request, id, annotations)
end
def select(id : String) : Annotation?
request = <<-SQL
SELECT * FROM annotations
WHERE id = $1
SQL
return PG_DB.query_one?(request, id, as: Annotation)
end
end
|