mirror of
https://github.com/commercialhaskell/stackage-server.git
synced 2026-01-12 04:08:29 +01:00
Added newestSnapshot
This commit is contained in:
parent
c3a59798cb
commit
b0ec509d9e
@ -4,10 +4,11 @@ module Stackage.Database
|
||||
, SnapName (..)
|
||||
, SnapshotId ()
|
||||
, Snapshot (..)
|
||||
, newestSnapshot
|
||||
, newestLTS
|
||||
, newestLTSMajor
|
||||
, ltsMajorVersions
|
||||
, newestNightly
|
||||
, ltsMajorVersions
|
||||
, snapshotBefore
|
||||
, nightlyBefore
|
||||
, ltsBefore
|
||||
@ -401,6 +402,11 @@ run inner = do
|
||||
StackageDatabase pool <- getStackageDatabase
|
||||
liftIO $ runSqlPool inner pool
|
||||
|
||||
newestSnapshot :: GetStackageDatabase m => SnapshotBranch -> m (Maybe SnapName)
|
||||
newestSnapshot LtsBranch = map (uncurry SNLts) <$> newestLTS
|
||||
newestSnapshot NightlyBranch = map SNNightly <$> newestNightly
|
||||
newestSnapshot (LtsMajorBranch x) = map (SNLts x) <$> newestLTSMajor x
|
||||
|
||||
newestLTS :: GetStackageDatabase m => m (Maybe (Int, Int))
|
||||
newestLTS =
|
||||
run $ liftM (fmap go) $ selectFirst [] [Desc LtsMajor, Desc LtsMinor]
|
||||
|
||||
Loading…
Reference in New Issue
Block a user