Commit 81bfb54f authored by MrMan's avatar MrMan

down to fromrow requirement

parent 94422e19
......@@ -331,13 +331,13 @@ insertEntity conn e@(WUUID uuid _) = case buildInsertQuery e of
Nothing -> pure $ Left $ UnexpectedErrorES "Failed to generate insert query"
Just (QWP query params) -> Right <$> executeNamed conn query params
getEntityByUUID :: (Insertable 'SQL entity,
Insertable 'SQL (WithID 'UUIDID entity),
getEntityByUUID :: forall entity.
(Insertable 'SQL entity,
FromRow (WithID 'UUIDID entity))
=> Connection
-> UUID
-> IO (Either EntityStoreError (WithID 'UUIDID entity))
getEntityByUUID conn uuid = maybe invalidEntityError doQuery $ case (getInsertInfo :: EntityInsertInfo 'SQL (WithID 'UUIDID entity)) of
getEntityByUUID conn uuid = maybe invalidEntityError doQuery $ case (getInsertInfo :: EntityInsertInfo 'SQL entity) of
(SQLEII tblName _ _) -> Just tblName
_ -> Nothing
where
......@@ -364,6 +364,8 @@ instance EntityStore 'SQL SQLiteEntityStore where
>>= rightOrThrow
-- | Generate an insert query for the `WithID entity`
>>= insertAndReturnEntity c
>>= rightOrThrow
>>= pure . Right . makeGenericIdent
-- | Get an entity by ID
get :: forall entity. SQLiteEntityStore -> Complete entity -> IO (Either EntityStoreError (Complete entity))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment