diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2020-08-30 17:31:48 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2020-10-17 21:08:05 +0200 |
commit | 93e583408af5f41f9dde324f198e47fa94e1881e (patch) | |
tree | cbe367236542e64571ce5cbf509d5ef9d515272c /src/Storage.hs | |
parent | 1eeb5cba2d3bbe07a19af65cb68375a9112ca8b8 (diff) |
Peer connection through ICE
Diffstat (limited to 'src/Storage.hs')
-rw-r--r-- | src/Storage.hs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Storage.hs b/src/Storage.hs index 92a1e1f..f73c420 100644 --- a/src/Storage.hs +++ b/src/Storage.hs @@ -35,7 +35,7 @@ module Storage ( loadBlob, loadRec, loadZero, loadInt, loadNum, loadText, loadBinary, loadDate, loadUUID, loadJson, loadRef, loadRawRef, loadMbInt, loadMbNum, loadMbText, loadMbBinary, loadMbDate, loadMbUUID, loadMbJson, loadMbRef, loadMbRawRef, - loadBinaries, loadRefs, loadRawRefs, + loadTexts, loadBinaries, loadRefs, loadRawRefs, loadZRef, Stored, @@ -720,6 +720,12 @@ loadMbText name = asks (lookup (BC.pack name) . snd) >>= \case Just (RecText x) -> Just <$> fromText x Just _ -> throwError $ "Expecting type text of record item '"++name++"'" +loadTexts :: StorableText a => String -> LoadRec [a] +loadTexts name = do + items <- map snd . filter ((BC.pack name ==) . fst) <$> asks snd + forM items $ \case RecText x -> fromText x + _ -> throwError $ "Expecting type text of record item '"++name++"'" + loadBinary :: BA.ByteArray a => String -> LoadRec a loadBinary name = maybe (throwError $ "Missing record item '"++name++"'") return =<< loadMbBinary name |