From 78c5467c4ac39869314c686d1d026482e7b3fd8f Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 4 Jul 2023 19:37:50 +0200 Subject: [haskell] Implemented ship --- haskell/src/SpaceTraders/Database/Ships.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 haskell/src/SpaceTraders/Database/Ships.hs (limited to 'haskell/src/SpaceTraders/Database/Ships.hs') diff --git a/haskell/src/SpaceTraders/Database/Ships.hs b/haskell/src/SpaceTraders/Database/Ships.hs new file mode 100644 index 0000000..81c422d --- /dev/null +++ b/haskell/src/SpaceTraders/Database/Ships.hs @@ -0,0 +1,13 @@ +{-# LANGUAGE OverloadedStrings #-} + +module SpaceTraders.Database.Ships + ( addShip + ) where + +import Data.Aeson +import qualified Database.SQLite.Simple as S + +import SpaceTraders.Model.Ship + +addShip :: S.Connection -> Ship -> IO () +addShip conn ship = S.execute conn "INSERT INTO ships(data) VALUES (json(?));" (S.Only (encode ship)) -- cgit v1.2.3