Server now compiles using abstracted SQLite
[?]
Oct 22, 2014, 2:11 AM
64VI73NPSFNWTL6UXM6YHRFLNJZ3NUJ2R3CL53MO2HSZWFGBIRTQCDependencies
- [2]
64C6AWH6Rename Ananke -> Quixotic, project reboot. - [3]
EQXRXRZDChanged to use tasty instead of test-framework - [4]
NVOCQVASInitial failing tests. - [5]
GKGVYBZGAdded JSON serialization to TimeLog - [6]
RSEB2NFGReplacing Snap with Scotty. - [7]
ADMKQQGCInitial empty Snap project. - [8]
4QX5E5ACInitial compilation of payouts function succeeds.
Change contents
- edit in quixotic.cabal at line 60
, sqlite - replacement in server/Main.hs at line 1
{-# LANGUAGE OverloadedStrings #-}{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-} - edit in server/Main.hs at line 5
import Control.Monad - edit in server/Main.hs at line 9
import qualified Data.Text as Timport qualified Data.Text.Lazy as LT - replacement in server/Main.hs at line 12
import Data.Time.Formatimport Database.SQLite - edit in server/Main.hs at line 15
import Quixotic.Database.SQLite - edit in server/Main.hs at line 23
main = dodb <- openConnection "quixotic.db"adb <- sqliteADB dbdbMain db adb - replacement in server/Main.hs at line 28
dbMain :: a -> ADB a -> IO ()dbMain :: a -> ADB IO a -> IO () - replacement in server/Main.hs at line 38
post "/logStart/:btcAddr" $ handleLogRequest adb StartWorkpost "/logEnd/:btcAddr" $ handleLogRequest db StopWorkpost "/logStart/:btcAddr" $ handleLogRequest db adb StartWorkpost "/logEnd/:btcAddr" $ handleLogRequest db adb StopWork - replacement in server/Main.hs at line 41
get "/payouts" $ currentPayouts adbget "/payouts" $ currentPayouts db adb - replacement in server/Main.hs at line 43
handleLogRequest :: ADB a -> (UTCTime -> WorkEvent) -> ActionM ()handleLogRequest db ev = dohandleLogRequest :: a -> ADB IO a -> (UTCTime -> WorkEvent) -> ActionM ()handleLogRequest db adb ev = do - replacement in server/Main.hs at line 47
liftIO . recordEvent db $ LogEntry addr (ev timestamp)liftIO $ recordEvent adb db $ LogEntry addr (ev timestamp) - replacement in server/Main.hs at line 49
currentPayouts :: ADB a -> ActionM ()currentPayouts db = docurrentPayouts :: a -> ADB IO a -> ActionM ()currentPayouts db adb = do - replacement in server/Main.hs at line 53
widx <- undefinedjson . PayoutsResponse $ payouts dep ptime widxbuildPayoutsResponse :: WorkIndex -> ActionM ()buildPayoutsResponse widx = json . PayoutsResponse $ payouts dep ptime widx - edit in server/Main.hs at line 57
payoutsAction :: EitherT T.Text ActionM WorkIndexpayoutsAction = mapEitherT liftIO $ readWorkIndex adb dbeitherT (raise . LT.fromStrict) buildPayoutsResponse payoutsAction - edit in src/Quixotic/Database/SQLite.hs at line 1
{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-} - replacement in src/Quixotic/Database/SQLite.hs at line 14
import System.Localeimport System.Locale (defaultTimeLocale) - replacement in src/Quixotic/Database/SQLite.hs at line 16
sqliteADB :: String -> IO (D.ADB IO SQLiteHandle)sqliteADB dbName = dodb <- openConnection "quixotic.db"sqliteADB :: SQLiteHandle -> IO (D.ADB IO SQLiteHandle)sqliteADB db = do_ <- defineTableOpt db True eventTable - replacement in src/Quixotic/Database/SQLite.hs at line 27
readWorkIndex :: SQLiteHandle -> EitherT String IO WorkIndexreadWorkIndex :: SQLiteHandle -> EitherT T.Text IO WorkIndex - replacement in src/Quixotic/Database/SQLite.hs at line 29
rows <- EitherT $ execStatement db "SELECT btcAddr, event, eventTime from workEvents"undefinedlet baseResult = EitherT $ execStatement db "SELECT btcAddr, event, eventTime from workEvents"rows <- bimapEitherT T.pack id baseResultreturn . intervals $ fmap parseRow (join rows) - edit in src/Quixotic/Database/SQLite.hs at line 33
parseRow :: Row Value -> LogEntryparseRow = undefined - edit in src/Quixotic/Database.hs at line 6
import Data.Text - replacement in src/Quixotic/Database.hs at line 11
, readWorkIndex :: a -> EitherT String m WorkIndex, readWorkIndex :: a -> EitherT Text m WorkIndex - replacement in src/Quixotic/TimeLog.hs at line 1
{-# LANGUAGE DeriveDataTypeable, ScopedTypeVariables, OverloadedStrings #-}{-# LANGUAGE ScopedTypeVariables, OverloadedStrings #-}