packages feed

cayley-client 0.3.3 → 0.4.0

raw patch · 3 files changed

+13/−10 lines, 3 filesdep ~aesondep ~cayley-clientPVP ok

version bump matches the API change (PVP)

Dependency ranges changed: aeson, cayley-client

API changes (from Hackage documentation)

- Database.Cayley.Client: queryShape :: CayleyConnection -> Query -> IO (Result Shape)
+ Database.Cayley.Client: queryShape :: CayleyConnection -> Query -> IO (Either String Shape)

Files

Database/Cayley/Client.hs view
@@ -82,7 +82,7 @@ -- | Return the description of the given executed query. queryShape :: CayleyConnection            -> Query-           -> IO (A.Result Shape)+           -> IO (Either String Shape) queryShape c q =   runReaderT (doShape (getManager c) (encodeUtf8 q)) (getConfig c)   where@@ -93,8 +93,11 @@              serverPort (RequestBodyBS _q)       return $         case r of-          Just o  -> A.fromJSON o-          Nothing -> A.Error "API request error"+          Just o  ->+            case A.fromJSON o of+              A.Success s -> Right s+              A.Error e   -> Left ("Not a shape (\"" ++ e ++ "\")")+          Nothing -> Left "API request error"  -- | Write a 'Quad' with the given subject, predicate, object and optional -- label. Throw result or extract amount of query 'results'
cayley-client.cabal view
@@ -1,5 +1,5 @@ name: cayley-client-version: 0.3.3+version: 0.4.0 cabal-version: >=1.10 build-type: Simple license: BSD3@@ -52,8 +52,8 @@     build-depends:         hspec >=2.1.10 && <2.5,         base >=4.8 && <5,-        cayley-client >=0.3.3 && <0.4,-        aeson >=0.8.0.2 && <1.1,+        cayley-client >=0.4.0 && <0.5,+        aeson >=0.8.0.2 && <1.2,         unordered-containers >=0.2.5 && <0.3     default-language: Haskell2010     hs-source-dirs: tests
tests/hspec.hs view
@@ -12,18 +12,18 @@     describe "write" $         it "writes a quad to Cayley server" $ do             c <- connectCayley defaultCayleyConfig-            write c Quad { subject = "danny", predicate = "follows", C.object = "sandy", label = Nothing } `shouldReturn` Just (Object (fromList [("result",String "Successfully wrote 1 quads.")]))+            write c Quad { subject = "<danny>", predicate = "<follows>", C.object = "<sandy>", label = Nothing } `shouldReturn` Just (Object (fromList [("result",String "Successfully wrote 1 quads.")]))      describe "query" $         it "query Cayley server" $ do             c <- connectCayley defaultCayleyConfig-            Right a <- query c "graph.Vertex('sandy').In('follows').All()"-            encode a `shouldBe` "[{\"id\":\"danny\"}]"+            Right a <- query c "graph.Vertex('<sandy>').In('<follows>').All()"+            encode a `shouldBe` "[{\"id\":\"<danny>\"}]"      describe "shape" $         it "returns the description of the last query executed" $ do             c <- connectCayley defaultCayleyConfig-            queryShape c "graph.Vertex('sandy').In('follows').All()" `shouldReturn` Success (Shape {nodes = [Node {CT.id = 4, tags = Nothing, values = Just ["sandy"], isLinkNode = False, isFixed = True},Node {CT.id = 8, tags = Nothing, values = Just ["follows"], isLinkNode = False, isFixed = True},Node {CT.id = 2, tags = Nothing, values = Nothing, isLinkNode = True, isFixed = False},Node {CT.id = 1, tags = Just ["id"], values = Nothing, isLinkNode = False, isFixed = False}], links = [Link {source = 1, target = 4, linkNode = 2}]})+            queryShape c "graph.Vertex('<sandy>').In('<follows>').All()" `shouldReturn` Right (Shape {nodes = [Node {CT.id = 4, tags = Nothing, values = Just ["<sandy>"], isLinkNode = False, isFixed = True},Node {CT.id = 8, tags = Nothing, values = Just ["<follows>"], isLinkNode = False, isFixed = True},Node {CT.id = 2, tags = Nothing, values = Nothing, isLinkNode = True, isFixed = False},Node {CT.id = 1, tags = Just ["id"], values = Nothing, isLinkNode = False, isFixed = False}], links = [Link {source = 1, target = 4, linkNode = 2}]})      describe "writeNQuadFile" $         it "writes quads from a file to Cayley server" $ do