blob: b907609fb130b5463ba9e6bf545175b7eca21458 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
module SpaceTraders.Database.Tokens
( getToken
, setToken
) where
import qualified Database.SQLite.Simple as S
import qualified Data.Text as T
getToken :: S.Connection -> IO (T.Text)
getToken conn = do
[[token]] <- S.query_ conn "SELECT data FROM tokens;"
return token
setToken :: S.Connection -> T.Text -> IO ()
setToken conn value = S.execute conn "INSERT INTO tokens(data) VALUES (?);" (S.Only value)
|