🎨 Explicitly added types for sqlite topic repository constants

This commit is contained in:
Maxim Lebedev 2023-12-19 19:57:28 +06:00
parent 5d2e33c513
commit 0828c0783a
Signed by: toby3d
GPG Key ID: 1F14E25B7C119FC5
1 changed files with 12 additions and 12 deletions

View File

@ -44,24 +44,24 @@ type (
)
const (
queryTable = `CREATE TABLE IF NOT EXISTS topics (
queryTable string = `CREATE TABLE IF NOT EXISTS topics (
created_at DATETIME,
updated_at DATETIME,
url TEXT PRIMARY KEY,
content_type TEXT,
content BLOB
)`
queryIndex = `CREATE INDEX urls ON topics (url);`
queryCreate = `INSERT INTO topics (created_at, updated_at, url, content_type, content)
VALUES (:created_at, :updated_at, :url, :content_type, :content);`
queryFetch = `SELECT * FROM topics;`
queryRead = `SELECT * FROM topics WHERE url = ?;`
queryUpdate = `UPDATE topics
SET updated_at = :updated_at,
content_type = :content_type,
content = :content
WHERE url = :url;`
queryDelete = `DELETE FROM topics WHERE url = ?;`
queryIndex string = `CREATE INDEX urls ON topics (url);`
queryCreate string = `INSERT INTO topics (created_at, updated_at, url, content_type, content)
VALUES (:created_at, :updated_at, :url, :content_type, :content);`
queryFetch string = `SELECT * FROM topics;`
queryRead string = `SELECT * FROM topics WHERE url = ?;`
queryUpdate string = `UPDATE topics
SET updated_at = :updated_at,
content_type = :content_type,
content = :content
WHERE url = :url;`
queryDelete string = `DELETE FROM topics WHERE url = ?;`
)
func NewSQLiteTopicRepository(db *sqlx.DB) (topic.Repository, error) {