From 4bd33a18c9c27ce297e1f3bb89661a67a5e30895 Mon Sep 17 00:00:00 2001 From: Sofya Date: Thu, 5 Apr 2018 17:28:38 +0300 Subject: [PATCH] More accurate on data fields with type (#12) --- CHANGELOG.md | 8 ++++++-- hasbolt-extras.cabal | 2 +- src/Database/Bolt/Extras/Query/Put.hs | 4 ++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b3dd1f..a0f354f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] -## [0.1.0.3] - 2018-04-05 +## [0.0.0.4] - 2018-04-05 +### Changed +- More accurate `toNode` on data fields with `Maybe a` type. If the corresponding field in the type is Nothing, this field won't be included to `Node`. + +## [0.0.0.3] - 2018-04-05 ### Changed - More accurate `fromNode` on data fields with `Maybe a` type. If there is no such field in Node, data field will be set to Nothing. -## [0.1.0.0] - 2018-02-22 +## [0.0.0.0] - 2018-02-22 ### Added - Template Haskell code to generate `Node`s and `URelationship`s. - Simple queries to upload `Node` and `URelationship`. diff --git a/hasbolt-extras.cabal b/hasbolt-extras.cabal index 94cebe5..7989506 100644 --- a/hasbolt-extras.cabal +++ b/hasbolt-extras.cabal @@ -1,5 +1,5 @@ name: hasbolt-extras -version: 0.0.0.3 +version: 0.0.0.4 synopsis: Extras for hasbolt library description: Extras for hasbolt library homepage: https://github.com/biocad/hasbolt-extras#readme diff --git a/src/Database/Bolt/Extras/Query/Put.hs b/src/Database/Bolt/Extras/Query/Put.hs index 9daa02b..2cae84d 100644 --- a/src/Database/Bolt/Extras/Query/Put.hs +++ b/src/Database/Bolt/Extras/Query/Put.hs @@ -16,7 +16,7 @@ import Data.Map.Strict (mapWithKey, toList, (!)) import qualified Data.Map.Strict as M (map) import qualified Data.Text as T (Text, pack) import Database.Bolt (BoltActionT, Node (..), - RecordValue (..), + RecordValue (..), Value (..), URelationship (..), at, exact, query) import Database.Bolt.Extras.Graph (Graph (..)) @@ -58,7 +58,7 @@ putNode ut = case ut of let varQ = "n" let labelsQ = toCypher $ labels node - let propsQ = toCypher . toList $ nodeProps node + let propsQ = toCypher . filter ((/= N ()) . snd) . toList $ nodeProps node let getQuery = [text|$q ($varQ $labelsQ {$propsQ}) RETURN ID($varQ) as $varQ|]