bdcs 0.2.2 → 0.2.3
raw patch · 4 files changed
+27/−2 lines, 4 files
Files
- ChangeLog.md +5/−0
- bdcs.cabal +1/−1
- src/BDCS/Builds.hs +10/−0
- src/BDCS/Sources.hs +11/−1
ChangeLog.md view
@@ -1,3 +1,8 @@+## 0.2.3++* Add BDCS.Builds.findBuilds.+* Add BDCS.Sources.findSources.+ ## 0.2.2 * Add BDCS.CS.fileToObjectC, which, when used as part of a conduit, fetches
bdcs.cabal view
@@ -1,5 +1,5 @@ name: bdcs-version: 0.2.2+version: 0.2.3 synopsis: Tools for managing a content store of software packages description: This module provides a library and various tools for managing a content store and metadata database. These store the contents of software packages that make up a
src/BDCS/Builds.hs view
@@ -15,6 +15,7 @@ module BDCS.Builds(associateBuildWithPackage, findBuild,+ findBuilds, getBuild, insertBuild, insertBuildKeyValue)@@ -49,6 +50,15 @@ build ^. BuildsArch ==. val arch limit 1 return $ build ^. BuildsId++-- | Given the key to a 'Sources' record, find all builds for that source in the database,+-- across all versions, arches, etc. The key for each result is returned.+findBuilds :: MonadIO m => Key Sources -> SqlPersistT m [Key Builds]+findBuilds sourceId = do+ vals <- select $ from $ \build -> do+ where_ $ build ^. BuildsSource_id ==. val sourceId+ return $ build ^. BuildsId+ return $ map unValue vals -- | Given a key to a 'Builds' record in the database, return that record. This function is -- suitable for using on the result of 'findBuild'.
src/BDCS/Sources.hs view
@@ -2,7 +2,7 @@ -- | -- Module: BDCS.Sources--- Copyright: (c) 2016-2017 Red Hat, Inc.+-- Copyright: (c) 2016-2018 Red Hat, Inc. -- License: LGPL -- -- Maintainer: https://github.com/weldr@@ -14,6 +14,7 @@ -- each of which will require a separate 'Sources' record. module BDCS.Sources(findSource,+ findSources, getSource, insertSource, insertSourceKeyValue)@@ -39,6 +40,15 @@ src ^. SourcesVersion ==. val version limit 1 return $ src ^. SourcesId++-- | Given a key to a 'Projects' record, find all software sources for that project in+-- the database. The key for each result is returned.+findSources :: MonadIO m => Key Projects -> SqlPersistT m [Key Sources]+findSources projectId = do+ vals <- select $ from $ \src -> do+ where_ $ src ^. SourcesProject_id ==. val projectId+ return $ src ^. SourcesId+ return $ map unValue vals -- | Given a key to a 'Sources' record in the database, return that record. This function -- is suitable for using on the result of 'findSource'.