Something went wrong. Try again.
(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol.
margin.at
extension web atproto comments
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149-- name: CreateBookmark :execINSERT INTO bookmarks (uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cid)VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)ON CONFLICT(uri) DO UPDATE SET source = EXCLUDED.source, source_hash = EXCLUDED.source_hash, title = EXCLUDED.title, description = EXCLUDED.description, tags_json = EXCLUDED.tags_json, indexed_at = EXCLUDED.indexed_at, cid = EXCLUDED.cid;
-- name: GetBookmarkByURI :oneSELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE uri = $1;
-- name: GetRecentBookmarks :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksORDER BY created_at DESCLIMIT $1 OFFSET $2;
-- name: GetPopularBookmarks :manySELECT b.uri, b.author_did, b.source, b.source_hash, b.title, b.description, b.tags_json, b.created_at, b.indexed_at, b.cidFROM all_bookmarks bLEFT JOIN LATERAL ( SELECT COUNT(*) as cnt FROM likes WHERE subject_uri = b.uri) l ON trueLEFT JOIN LATERAL ( SELECT COUNT(*) as cnt FROM replies WHERE root_uri = b.uri) r ON trueWHERE b.created_at > $1 AND (l.cnt + r.cnt) > 0ORDER BY (l.cnt + r.cnt) DESC, b.created_at DESCLIMIT $2 OFFSET $3;
-- name: GetShelvedBookmarks :manySELECT b.uri, b.author_did, b.source, b.source_hash, b.title, b.description, b.tags_json, b.created_at, b.indexed_at, b.cidFROM all_bookmarks bWHERE b.created_at < $1 AND b.created_at > $2 AND NOT EXISTS (SELECT 1 FROM likes WHERE subject_uri = b.uri) AND NOT EXISTS (SELECT 1 FROM replies WHERE root_uri = b.uri)ORDER BY RANDOM()LIMIT $3 OFFSET $4;
-- name: GetMarginBookmarks :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE uri NOT LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $1 OFFSET $2;
-- name: GetSembleBookmarks :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE uri LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $1 OFFSET $2;
-- name: GetBookmarksByTag :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE lower(tags_json)::jsonb ? $1ORDER BY created_at DESCLIMIT $2 OFFSET $3;
-- name: GetMarginBookmarksByTag :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE lower(tags_json)::jsonb ? $1 AND uri NOT LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $2 OFFSET $3;
-- name: GetSembleBookmarksByTag :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE lower(tags_json)::jsonb ? $1 AND uri LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $2 OFFSET $3;
-- name: GetBookmarksByTagAndAuthor :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE author_did = $1 AND lower(tags_json)::jsonb ? $2ORDER BY created_at DESCLIMIT $3 OFFSET $4;
-- name: GetMarginBookmarksByTagAndAuthor :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE author_did = $1 AND lower(tags_json)::jsonb ? $2 AND uri NOT LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $3 OFFSET $4;
-- name: GetSembleBookmarksByTagAndAuthor :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE author_did = $1 AND lower(tags_json)::jsonb ? $2 AND uri LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $3 OFFSET $4;
-- name: GetBookmarksByAuthor :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE author_did = $1ORDER BY created_at DESCLIMIT $2 OFFSET $3;
-- name: GetMarginBookmarksByAuthor :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE author_did = $1 AND uri NOT LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $2 OFFSET $3;
-- name: GetSembleBookmarksByAuthor :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE author_did = $1 AND uri LIKE '%network.cosmik%'ORDER BY created_at DESCLIMIT $2 OFFSET $3;
-- name: DeleteBookmark :execDELETE FROM bookmarks WHERE uri = $1;
-- name: UpdateBookmark :execUPDATE bookmarksSET title = $1, description = $2, tags_json = $3, cid = $4, indexed_at = $5WHERE uri = $6;
-- name: GetBookmarksByURIs :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE uri = ANY($1::text[]);
-- name: GetBookmarkURIs :manySELECT uri FROM all_bookmarks WHERE author_did = $1;
-- name: GetBookmarksByTargetHash :manySELECT uri, author_did, source, source_hash, title, description, tags_json, created_at, indexed_at, cidFROM all_bookmarksWHERE source_hash = $1ORDER BY created_at DESCLIMIT $2 OFFSET $3;