summaryrefslogtreecommitdiff
path: root/haskell/src/SpaceTraders/Database/Agents.hs
blob: 48cd65bfb137bc61e04b6229c12d7e2ff0b5ee19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
{-# LANGUAGE OverloadedStrings #-}

module SpaceTraders.Database.Agents
  ( setAgent
  ) where

import Data.Aeson
import qualified Database.SQLite.Simple as S

import SpaceTraders.Model.Agent

setAgent :: S.Connection -> Agent -> IO ()
setAgent conn agent = S.execute conn "INSERT INTO agents(data) VALUES (json(?));" (S.Only (encode agent))