Something went wrong. Try again.
(READ ONLY) Margin is an open annotation layer for the internet. Powered by the AT Protocol.
margin.at
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475-- name: CreateNote :execINSERT INTO notes ( uri, author_did, motivation, color, description, body_value, body_format, body_uri, target_source, target_hash, target_title, selector_json, tags_json, created_at, indexed_at, cid) VALUES ( $1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16) ON CONFLICT (uri) DO UPDATE SET motivation = EXCLUDED.motivation, color = EXCLUDED.color, description = EXCLUDED.description, body_value = EXCLUDED.body_value, body_format = EXCLUDED.body_format, body_uri = EXCLUDED.body_uri, target_source = EXCLUDED.target_source, target_hash = EXCLUDED.target_hash, target_title = EXCLUDED.target_title, selector_json = EXCLUDED.selector_json, tags_json = EXCLUDED.tags_json, indexed_at = EXCLUDED.indexed_at, cid = EXCLUDED.cid;
-- name: GetNoteByURI :oneSELECT uri, author_did, motivation, color, description, body_value, body_format, body_uri, target_source, target_hash, target_title, selector_json, tags_json, created_at, indexed_at, cidFROM notes WHERE uri = $1;
-- name: MarginNoteBookmarkExists :oneSELECT 1 FROM notesWHERE author_did = $1 AND target_hash = $2 AND motivation = 'bookmarking' AND uri LIKE 'at://%/at.margin.note/%'LIMIT 1;
-- name: SaveCommunityBookmarkRef :execINSERT INTO community_bookmark_refs (note_uri, community_uri)VALUES ($1, $2)ON CONFLICT (note_uri) DO UPDATE SET community_uri = EXCLUDED.community_uri;
-- name: GetCommunityBookmarkURI :oneSELECT community_uri FROM community_bookmark_refs WHERE note_uri = $1;
-- name: DeleteCommunityBookmarkRef :execDELETE FROM community_bookmark_refs WHERE note_uri = $1;
-- name: CommunityBookmarkExists :oneSELECT 1 FROM community_bookmark_refs cbrJOIN notes n ON n.uri = cbr.note_uriWHERE n.author_did = $1 AND n.target_hash = $2LIMIT 1;
-- name: GetNotesByURIs :manySELECT uri, author_did, motivation, color, description, body_value, body_format, body_uri, target_source, target_hash, target_title, selector_json, tags_json, created_at, indexed_at, cidFROM notes WHERE uri = ANY($1::text[]);
-- name: DeleteNote :execDELETE FROM notes WHERE uri = $1;
-- name: UpdateNoteAnnotation :execUPDATE notesSET body_value = $1, tags_json = NULLIF($2, ''), cid = $3, indexed_at = $4WHERE uri = $5;
-- name: UpdateNoteHighlight :execUPDATE notesSET color = NULLIF($1, ''), tags_json = NULLIF($2, ''), cid = $3, indexed_at = $4WHERE uri = $5;
-- name: UpdateNoteBookmark :execUPDATE notesSET target_title = NULLIF($1, ''), body_value = NULLIF($2, ''), tags_json = NULLIF($3, ''), cid = $4, indexed_at = $5WHERE uri = $6;