module Database.Bolt.Extras.Internal.Types
(
FromValue (..)
, Label
, Labels (..)
, NodeLike (..)
, Properties (..)
, Property
, ToValue (..)
, URelationLike (..)
, ToIsValue (..)
, NodeLikeProps (..)
) where
import GHC.Stack (HasCallStack)
import Data.Map.Strict (Map)
import Data.Text (Text)
import Database.Bolt (Node (..), URelationship (..), Value (..))
type Label = Text
type Property = (Text, Value)
class NodeLike a where
toNode :: HasCallStack => a -> Node
fromNode :: HasCallStack => Node -> a
class URelationLike a where
toURelation :: HasCallStack => a -> URelationship
fromURelation :: HasCallStack => URelationship -> a
class ToValue a where
toValue :: HasCallStack => a -> Value
class FromValue a where
fromValue :: HasCallStack => Value -> a
class Labels a where
getLabels :: HasCallStack => a -> [Label]
instance Labels Node where
getLabels :: HasCallStack => Node -> [Label]
getLabels = Node -> [Label]
labels
instance Labels URelationship where
getLabels :: HasCallStack => URelationship -> [Label]
getLabels = forall (f :: * -> *) a. Applicative f => a -> f a
pure forall b c a. (b -> c) -> (a -> b) -> a -> c
. URelationship -> Label
urelType
class Properties a where
getProps :: HasCallStack => a -> Map Text Value
instance Properties Node where
getProps :: HasCallStack => Node -> Map Label Value
getProps = Node -> Map Label Value
nodeProps
instance Properties URelationship where
getProps :: HasCallStack => URelationship -> Map Label Value
getProps = URelationship -> Map Label Value
urelProps
newtype ToIsValue a = ToIsValue a
newtype NodeLikeProps a = NodeLikeProps a