add getContentIdentifiers
Changed the database schema for this, with a new index.
This commit is contained in:
parent
00722ba1f8
commit
138d07eb97
1 changed files with 10 additions and 1 deletions
|
@ -41,7 +41,8 @@ ContentIdentifiers
|
||||||
remote UUID
|
remote UUID
|
||||||
cid ContentIdentifier
|
cid ContentIdentifier
|
||||||
key SKey
|
key SKey
|
||||||
ContentIdentifiersIndex remote cid
|
ContentIdentifiersIndexRemoteKey remote key
|
||||||
|
ContentIdentifiersIndexRemoteCID remote cid
|
||||||
UniqueRemoteCidKey remote cid key
|
UniqueRemoteCidKey remote cid key
|
||||||
|]
|
|]
|
||||||
|
|
||||||
|
@ -79,6 +80,14 @@ recordContentIdentifier :: ContentIdentifierHandle -> UUID -> ContentIdentifier
|
||||||
recordContentIdentifier h u cid k = queueDb h $ do
|
recordContentIdentifier h u cid k = queueDb h $ do
|
||||||
void $ insertUnique $ ContentIdentifiers u cid (toSKey k)
|
void $ insertUnique $ ContentIdentifiers u cid (toSKey k)
|
||||||
|
|
||||||
|
getContentIdentifiers :: ContentIdentifierHandle -> UUID -> Key -> IO [ContentIdentifier]
|
||||||
|
getContentIdentifiers (ContentIdentifierHandle h) u k = H.queryDbQueue h $ do
|
||||||
|
l <- selectList
|
||||||
|
[ ContentIdentifiersCid ==. cid
|
||||||
|
, ContentIdentifiersKey ==. toSKey k
|
||||||
|
] []
|
||||||
|
return $ map (ContentIdentifiersCid . entityVal) l
|
||||||
|
|
||||||
getContentIdentifierKeys :: ContentIdentifierHandle -> UUID -> ContentIdentifier -> IO [Key]
|
getContentIdentifierKeys :: ContentIdentifierHandle -> UUID -> ContentIdentifier -> IO [Key]
|
||||||
getContentIdentifierKeys (ContentIdentifierHandle h) u cid =
|
getContentIdentifierKeys (ContentIdentifierHandle h) u cid =
|
||||||
H.queryDbQueue h $ do
|
H.queryDbQueue h $ do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue