graphql-w-persistent 0.3.1.0 → 0.3.1.1
raw patch · 3 files changed
+11/−5 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- ChangeLog.md +5/−1
- graphql-w-persistent.cabal +1/−1
- src/Components/DataProcessors/PersistentDataProcessor.hs +5/−3
ChangeLog.md view
@@ -46,4 +46,8 @@ ## 0.3.1.0 -- 2018-11-07 -* Give thrown exceptions+* Give thrown exceptions + +## 0.3.1.1 -- 2018-11-07 + +* bug fix: processing sql data was incorrect from object to nested object with generalized database entities, though this is now fixed.
graphql-w-persistent.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.3.1.0 +version: 0.3.1.1 -- A short (one-line) description of the package. synopsis: Haskell GraphQL query parser-interpreter-data processor.
src/Components/DataProcessors/PersistentDataProcessor.hs view
@@ -21,7 +21,9 @@ -- with SubFields and data rows, we want json representation on qraphql query data processSubFields :: [(String,[(String,String)])] -> String -> [Field] -> [[[Text]]] -> [JSValue] processSubFields _ _ _ [] = [] -processSubFields sss sobj sfs rlts = foldr (\x y -> x++y) [] [((showJSON $ toJSObject $ composeGraphQlRow sss sobj sfs $ fetchGraphQlRow typ):(processSubFields sss sobj sfs [removeDataRow typ])) |typ<-rlts,(length typ)>0] +processSubFields sss sobj sfs rlts = if length(qryData)>0 then ((showJSON $ toJSObject $ composeGraphQlRow sss sobj sfs $ fetchGraphQlRow qryData):(processSubFields sss sobj sfs [removeDataRow qryData])) else [] + where + qryData = foldr (\x y -> x++y) [] rlts composeGraphQlRow :: [(String,[(String,String)])] -> String -> [Field] -> [[Text]] -> [(String,JSValue)] composeGraphQlRow _ _ [] ([]:t) = [] -- done -- composeGraphQlRow _ _ _ [] = [] -- no data @@ -34,9 +36,9 @@ nestedObjectFieldCount = (countNestedObjectQueriedFields $ fromRight (E.throw InvalidObjectException) a) scalarField = (fromLeft (E.throw InvalidScalarException) a) fetchGraphQlRow :: [[Text]] -> [[Text]] -fetchGraphQlRow rlts = [t | (h:t)<-rlts, (h)==(head $ head rlts)] +fetchGraphQlRow rlts = [t | (h:t)<-rlts, ((h)==(head $ head rlts))&&((head t)==(head $ tail $ head rlts))] removeDataRow :: [[Text]] -> [[Text]] -removeDataRow rlts = [x | x<-rlts, (head x)/=(head $ head rlts)] +removeDataRow rlts = [x | x<-rlts, (head x)/=(head $ head rlts)||((head $ tail x)/=(head $ tail $ head rlts))] getScalarFieldLabel :: ScalarType -> String getScalarFieldLabel (ScalarType alias name trans arg) = if (alias/=Nothing) then (fromJust alias) else name getScalarFieldName :: ScalarType -> String