diff options
Diffstat (limited to '')
-rw-r--r-- | haskell/src/SpaceTraders/Database/Agents.hs | 1 | ||||
-rw-r--r-- | haskell/src/SpaceTraders/Database/Contracts.hs | 13 |
2 files changed, 13 insertions, 1 deletions
diff --git a/haskell/src/SpaceTraders/Database/Agents.hs b/haskell/src/SpaceTraders/Database/Agents.hs index 5be7389..48cd65b 100644 --- a/haskell/src/SpaceTraders/Database/Agents.hs +++ b/haskell/src/SpaceTraders/Database/Agents.hs @@ -1,5 +1,4 @@ {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE QuasiQuotes #-} module SpaceTraders.Database.Agents ( setAgent diff --git a/haskell/src/SpaceTraders/Database/Contracts.hs b/haskell/src/SpaceTraders/Database/Contracts.hs new file mode 100644 index 0000000..1ef5d6d --- /dev/null +++ b/haskell/src/SpaceTraders/Database/Contracts.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE OverloadedStrings #-} + +module SpaceTraders.Database.Contracts + ( addContract + ) where + +import Data.Aeson +import qualified Database.SQLite.Simple as S + +import SpaceTraders.Model.Contract + +addContract :: S.Connection -> Contract -> IO () +addContract conn contract = S.execute conn "INSERT INTO contracts(data) VALUES (json(?));" (S.Only (encode contract)) |