Files
Tomas Dvorak 954a1a1080 feat: migrate to DragonflyDB and clean up environment configuration
- Replace Redis with DragonflyDB for better performance and memory efficiency
- Remove redundant environment variables (POSTGRES_*, ENCRYPTION_KEY, OAUTH_SERVICE_URL)
- Consolidate database configuration to use single DB_* variables
- Use JWT_SECRET for both JWT tokens and encryption
- Remove PORT variable redundancy, use BACKEND_PORT consistently
- Clean up docker-compose configurations for dev/prod consistency
- Add DragonflyDB configuration with optimized memory usage
- Remove redis.conf as it's no longer needed
- Update health checks to use Redis-compatible CLI for DragonflyDB
- Add missing VITE_API_URL to production frontend
- Fix GitHub Actions to use correct go.sum path
- Clean up development directories and unused files
2026-03-05 23:51:34 +01:00

341 lines
8.1 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
// source: bookmarks.sql
package sqlc
import (
"context"
"github.com/jackc/pgx/v5/pgtype"
)
const AddBookmarkTag = `-- name: AddBookmarkTag :exec
INSERT INTO bookmark_tags (bookmark_id, tag_id) VALUES ($1, $2) ON CONFLICT DO NOTHING
`
type AddBookmarkTagParams struct {
BookmarkID pgtype.UUID `json:"bookmarkId"`
TagID pgtype.UUID `json:"tagId"`
}
func (q *Queries) AddBookmarkTag(ctx context.Context, arg AddBookmarkTagParams) error {
_, err := q.db.Exec(ctx, AddBookmarkTag, arg.BookmarkID, arg.TagID)
return err
}
const CreateBookmark = `-- name: CreateBookmark :one
INSERT INTO bookmarks (title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
RETURNING id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
`
type CreateBookmarkParams struct {
Title string `json:"title"`
Url string `json:"url"`
Description *string `json:"description"`
FaviconUrl *string `json:"faviconUrl"`
ScreenshotUrl *string `json:"screenshotUrl"`
UserID pgtype.UUID `json:"userId"`
IsArchived *bool `json:"isArchived"`
IsFavorite *bool `json:"isFavorite"`
}
func (q *Queries) CreateBookmark(ctx context.Context, arg CreateBookmarkParams) (Bookmark, error) {
row := q.db.QueryRow(ctx, CreateBookmark,
arg.Title,
arg.Url,
arg.Description,
arg.FaviconUrl,
arg.ScreenshotUrl,
arg.UserID,
arg.IsArchived,
arg.IsFavorite,
)
var i Bookmark
err := row.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.Description,
&i.FaviconUrl,
&i.ScreenshotUrl,
&i.UserID,
&i.IsArchived,
&i.IsFavorite,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const DeleteBookmark = `-- name: DeleteBookmark :exec
DELETE FROM bookmarks WHERE id = $1 AND user_id = $2
`
type DeleteBookmarkParams struct {
ID pgtype.UUID `json:"id"`
UserID pgtype.UUID `json:"userId"`
}
func (q *Queries) DeleteBookmark(ctx context.Context, arg DeleteBookmarkParams) error {
_, err := q.db.Exec(ctx, DeleteBookmark, arg.ID, arg.UserID)
return err
}
const GetBookmarkByID = `-- name: GetBookmarkByID :one
SELECT id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
FROM bookmarks
WHERE id = $1 AND user_id = $2 LIMIT 1
`
type GetBookmarkByIDParams struct {
ID pgtype.UUID `json:"id"`
UserID pgtype.UUID `json:"userId"`
}
func (q *Queries) GetBookmarkByID(ctx context.Context, arg GetBookmarkByIDParams) (Bookmark, error) {
row := q.db.QueryRow(ctx, GetBookmarkByID, arg.ID, arg.UserID)
var i Bookmark
err := row.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.Description,
&i.FaviconUrl,
&i.ScreenshotUrl,
&i.UserID,
&i.IsArchived,
&i.IsFavorite,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}
const GetBookmarksByTag = `-- name: GetBookmarksByTag :many
SELECT b.id, b.title, b.url, b.description, b.favicon_url, b.screenshot_url, b.user_id, b.is_archived, b.is_favorite, b.created_at, b.updated_at
FROM bookmarks b
INNER JOIN bookmark_tags bt ON b.id = bt.bookmark_id
INNER JOIN tags t ON bt.tag_id = t.id
WHERE t.id = $1 AND b.user_id = $2
ORDER BY b.created_at DESC
LIMIT $3 OFFSET $4
`
type GetBookmarksByTagParams struct {
ID pgtype.UUID `json:"id"`
UserID pgtype.UUID `json:"userId"`
Limit int32 `json:"limit"`
Offset int32 `json:"offset"`
}
func (q *Queries) GetBookmarksByTag(ctx context.Context, arg GetBookmarksByTagParams) ([]Bookmark, error) {
rows, err := q.db.Query(ctx, GetBookmarksByTag,
arg.ID,
arg.UserID,
arg.Limit,
arg.Offset,
)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Bookmark{}
for rows.Next() {
var i Bookmark
if err := rows.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.Description,
&i.FaviconUrl,
&i.ScreenshotUrl,
&i.UserID,
&i.IsArchived,
&i.IsFavorite,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const GetBookmarksByUser = `-- name: GetBookmarksByUser :many
SELECT id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
FROM bookmarks
WHERE user_id = $1
ORDER BY created_at DESC
LIMIT $2 OFFSET $3
`
type GetBookmarksByUserParams struct {
UserID pgtype.UUID `json:"userId"`
Limit int32 `json:"limit"`
Offset int32 `json:"offset"`
}
func (q *Queries) GetBookmarksByUser(ctx context.Context, arg GetBookmarksByUserParams) ([]Bookmark, error) {
rows, err := q.db.Query(ctx, GetBookmarksByUser, arg.UserID, arg.Limit, arg.Offset)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Bookmark{}
for rows.Next() {
var i Bookmark
if err := rows.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.Description,
&i.FaviconUrl,
&i.ScreenshotUrl,
&i.UserID,
&i.IsArchived,
&i.IsFavorite,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const RemoveBookmarkTag = `-- name: RemoveBookmarkTag :exec
DELETE FROM bookmark_tags WHERE bookmark_id = $1 AND tag_id = $2
`
type RemoveBookmarkTagParams struct {
BookmarkID pgtype.UUID `json:"bookmarkId"`
TagID pgtype.UUID `json:"tagId"`
}
func (q *Queries) RemoveBookmarkTag(ctx context.Context, arg RemoveBookmarkTagParams) error {
_, err := q.db.Exec(ctx, RemoveBookmarkTag, arg.BookmarkID, arg.TagID)
return err
}
const SearchBookmarks = `-- name: SearchBookmarks :many
SELECT id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
FROM bookmarks
WHERE user_id = $1 AND (
title ILIKE $2 OR
description ILIKE $2 OR
url ILIKE $2
)
ORDER BY created_at DESC
LIMIT $3 OFFSET $4
`
type SearchBookmarksParams struct {
UserID pgtype.UUID `json:"userId"`
Title string `json:"title"`
Limit int32 `json:"limit"`
Offset int32 `json:"offset"`
}
func (q *Queries) SearchBookmarks(ctx context.Context, arg SearchBookmarksParams) ([]Bookmark, error) {
rows, err := q.db.Query(ctx, SearchBookmarks,
arg.UserID,
arg.Title,
arg.Limit,
arg.Offset,
)
if err != nil {
return nil, err
}
defer rows.Close()
items := []Bookmark{}
for rows.Next() {
var i Bookmark
if err := rows.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.Description,
&i.FaviconUrl,
&i.ScreenshotUrl,
&i.UserID,
&i.IsArchived,
&i.IsFavorite,
&i.CreatedAt,
&i.UpdatedAt,
); err != nil {
return nil, err
}
items = append(items, i)
}
if err := rows.Err(); err != nil {
return nil, err
}
return items, nil
}
const UpdateBookmark = `-- name: UpdateBookmark :one
UPDATE bookmarks
SET title = $2,
url = $3,
description = $4,
favicon_url = $5,
screenshot_url = $6,
is_archived = $7,
is_favorite = $8,
updated_at = CURRENT_TIMESTAMP
WHERE id = $1 AND user_id = $9
RETURNING id, title, url, description, favicon_url, screenshot_url, user_id, is_archived, is_favorite, created_at, updated_at
`
type UpdateBookmarkParams struct {
ID pgtype.UUID `json:"id"`
Title string `json:"title"`
Url string `json:"url"`
Description *string `json:"description"`
FaviconUrl *string `json:"faviconUrl"`
ScreenshotUrl *string `json:"screenshotUrl"`
IsArchived *bool `json:"isArchived"`
IsFavorite *bool `json:"isFavorite"`
UserID pgtype.UUID `json:"userId"`
}
func (q *Queries) UpdateBookmark(ctx context.Context, arg UpdateBookmarkParams) (Bookmark, error) {
row := q.db.QueryRow(ctx, UpdateBookmark,
arg.ID,
arg.Title,
arg.Url,
arg.Description,
arg.FaviconUrl,
arg.ScreenshotUrl,
arg.IsArchived,
arg.IsFavorite,
arg.UserID,
)
var i Bookmark
err := row.Scan(
&i.ID,
&i.Title,
&i.Url,
&i.Description,
&i.FaviconUrl,
&i.ScreenshotUrl,
&i.UserID,
&i.IsArchived,
&i.IsFavorite,
&i.CreatedAt,
&i.UpdatedAt,
)
return i, err
}