add getExportedKey
Not optimised because that would need transition code to be written for existing export datbases.
This commit is contained in:
parent
138d07eb97
commit
b67fa2180e
1 changed files with 15 additions and 0 deletions
|
@ -19,6 +19,7 @@ module Database.Export (
|
|||
addExportedLocation,
|
||||
removeExportedLocation,
|
||||
getExportedLocation,
|
||||
getExportedKey,
|
||||
isExportDirectoryEmpty,
|
||||
getExportTreeCurrent,
|
||||
recordExportTreeCurrent,
|
||||
|
@ -154,6 +155,20 @@ getExportedLocation (ExportHandle h _) k = H.queryDbQueue h $ do
|
|||
where
|
||||
ik = toIKey k
|
||||
|
||||
{- Get the key that was exported to a location.
|
||||
-
|
||||
- Note that the database does not currently have an index to make this
|
||||
- fast.
|
||||
-
|
||||
- Note that this does not see recently queued changes.
|
||||
-}
|
||||
getExportedKey :: ExportHandle -> ExportLocation -> IO [Key]
|
||||
getExportedKey ExportHandle h _) el = H.queryDbQueue h $ do
|
||||
l <- selectList [ExportedFile ==. ef] []
|
||||
return $ map (fromSKey . exportedKey . entityVal) l
|
||||
where
|
||||
ef = toSFilePath (fromExportLocation el)
|
||||
|
||||
{- Note that this does not see recently queued changes. -}
|
||||
isExportDirectoryEmpty :: ExportHandle -> ExportDirectory -> IO Bool
|
||||
isExportDirectoryEmpty (ExportHandle h _) d = H.queryDbQueue h $ do
|
||||
|
|
Loading…
Reference in a new issue