diff options
author | Julien Dessaux | 2023-07-03 21:29:15 +0200 |
---|---|---|
committer | Julien Dessaux | 2023-07-03 21:29:15 +0200 |
commit | b3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578 (patch) | |
tree | 8f596ee49ad84f320d5950fe5690bee335f930be /haskell/src/SpaceTraders/Database | |
parent | Bootstrapped my haskell client (diff) | |
download | spacetraders-b3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578.tar.gz spacetraders-b3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578.tar.bz2 spacetraders-b3d57cb6adf1e3f6a8ba7cf1c1553b6fd4acb578.zip |
[haskell] Implemented contract
Diffstat (limited to 'haskell/src/SpaceTraders/Database')
-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)) |