summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Database/Contracts.hs
blob: 1ef5d6dc750992a5297ad44507bd37e0adf3624d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
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))