module Database.Bolt.Extras.Internal.Types
(
FromValue (..)
, Label
, Labels (..)
, NodeLike (..)
, Properties (..)
, Property
, ToValue (..)
, URelationLike (..)
) where
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 :: a -> Node
fromNode :: Node -> a
class URelationLike a where
toURelation :: a -> URelationship
fromURelation :: URelationship -> a
class ToValue a where
toValue :: a -> Value
class FromValue a where
fromValue :: Value -> a
class Labels a where
getLabels :: a -> [Label]
instance Labels Node where
getLabels :: Node -> [Label]
getLabels = Node -> [Label]
labels
instance Labels URelationship where
getLabels :: URelationship -> [Label]
getLabels = Label -> [Label]
forall (f :: * -> *) a. Applicative f => a -> f a
pure (Label -> [Label])
-> (URelationship -> Label) -> URelationship -> [Label]
forall b c a. (b -> c) -> (a -> b) -> a -> c
. URelationship -> Label
urelType
class Properties a where
getProps :: a -> Map Text Value
instance Properties Node where
getProps :: Node -> Map Label Value
getProps = Node -> Map Label Value
nodeProps
instance Properties URelationship where
getProps :: URelationship -> Map Label Value
getProps = URelationship -> Map Label Value
urelProps