some clarification
This commit is contained in:
parent
7516b7912f
commit
8cf5edb0bb
1 changed files with 4 additions and 2 deletions
|
@ -19,6 +19,8 @@ import Opaleye as O
|
||||||
import Types
|
import Types
|
||||||
import Classes
|
import Classes
|
||||||
|
|
||||||
|
-- | This function does (as opposed to all other init functions) create just the table,
|
||||||
|
-- but also creates a first settings object with default values.
|
||||||
initSettings :: PGS.Query
|
initSettings :: PGS.Query
|
||||||
initSettings = mconcat
|
initSettings = mconcat
|
||||||
[ "CREATE TABLE IF NOT EXISTS \"settings\" ("
|
[ "CREATE TABLE IF NOT EXISTS \"settings\" ("
|
||||||
|
@ -42,8 +44,8 @@ settingsTable = table "settings" (
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
getSettings :: PGS.Connection -> MateHandler Settings
|
selectSettings :: PGS.Connection -> MateHandler Settings
|
||||||
getSettings conn = liftIO $ do
|
selectSettings conn = liftIO $ do
|
||||||
head . map fromDatabase <$> runSelect conn
|
head . map fromDatabase <$> runSelect conn
|
||||||
( proc () -> do
|
( proc () -> do
|
||||||
ret <- limit 1 $ selectTable settingsTable -< ()
|
ret <- limit 1 $ selectTable settingsTable -< ()
|
||||||
|
|
Loading…
Reference in a new issue