@@ -32,6 +32,7 @@ import qualified Data.Conduit.List as CL
32import ProjectM36.RelationalExpression (unsafeCast)
32import ProjectM36.RelationalExpression (unsafeCast)
33import Data.Typeable (typeRep, typeOf, Proxy(..))
33import Data.Typeable (typeRep, typeOf, Proxy(..))
34import Data.Time.Calendar (Day)
34import Data.Time.Calendar (Day)
35+import Data.ByteString (ByteString)
36type ProjectM36Backend = C.Connection
37type ProjectM36Backend = C.Connection
@@ -76,15 +77,17 @@ persistValueAtom val = case val of
77atomAsPersistValue :: Atom -> PersistValue
78atomAsPersistValue :: Atom -> PersistValue
78atomAsPersistValue atom@(Atom atomv) = if typeRep (Proxy :: Proxy Int) == typeOf atomv then
79atomAsPersistValue atom@(Atom atomv) = if typeRep (Proxy :: Proxy Int) == typeOf atomv then
79− PersistInt64 (fromIntegral ((unsafeCast atom) :: Int))
80+ PersistInt64 (fromIntegral ((unsafeCast atom) :: Int))
80 else if typeRep (Proxy :: Proxy T.Text) == typeOf atomv then
81 else if typeRep (Proxy :: Proxy T.Text) == typeOf atomv then
81− PersistText (unsafeCast atom)
82+ PersistText (unsafeCast atom)
82− else if typeRep (Proxy :: Proxy Bool) == typeOf atomv then
83+ else if typeRep (Proxy :: Proxy Bool) == typeOf atomv then
83− PersistBool (unsafeCast atom)
84+ PersistBool (unsafeCast atom)
84− else if typeRep (Proxy :: Proxy Day) == typeOf atomv then
85+ else if typeRep (Proxy :: Proxy Day) == typeOf atomv then
85− PersistDay (unsafeCast atom)
86+ PersistDay (unsafeCast atom)
87+ else if typeRep (Proxy :: Proxy ByteString) == typeOf atomv then
88+ PersistByteString (unsafeCast atom)
87− error "missing conversion"
90+ error "missing conversion"
89recordAsAtoms :: forall record. (PersistEntity record, PersistEntityBackend record ~ C.Connection)
92recordAsAtoms :: forall record. (PersistEntity record, PersistEntityBackend record ~ C.Connection)
90 => Maybe U.UUID -> Attributes -> record -> Either RelationalError (V.Vector Atom)
93 => Maybe U.UUID -> Attributes -> record -> Either RelationalError (V.Vector Atom)