2014-08-13 22:52:57 +00:00
|
|
|
module Helper
|
|
|
|
( getUserIdFromText
|
2014-08-14 00:25:18 +00:00
|
|
|
, extractKey
|
2014-08-13 22:52:57 +00:00
|
|
|
)
|
|
|
|
where
|
|
|
|
|
|
|
|
import Prelude
|
|
|
|
import Data.Text
|
|
|
|
import Database.Persist.Types
|
|
|
|
|
|
|
|
getUserIdFromText :: Text -> PersistValue
|
|
|
|
getUserIdFromText tempUserId =
|
|
|
|
PersistInt64 $ fromIntegral $ read $ unpack tempUserId
|
2014-08-14 00:25:18 +00:00
|
|
|
|
|
|
|
extractKey :: KeyBackend backend entity -> Text
|
|
|
|
extractKey = extractKey' . unKey
|
|
|
|
where
|
|
|
|
extractKey' (PersistInt64 k) = pack $ show k
|
|
|
|
extractKey' _ = ""
|