-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Haskell driver for Neo4j 3+ (BOLT protocol)
--   
--   Haskell driver for Neo4j 3+ (BOLT protocol).
--   
--   The package covers:
--   
--   <ul>
--   <li>Data serialization and deserialization</li>
--   <li>Nodes, relationships and paths support</li>
--   <li>Cypher queries and responses</li>
--   <li>Authentification</li>
--   <li>TLS/SSL connection</li>
--   </ul>
--   
--   The code was tested with neo4j versions 3.0 — 3.3 and GrapheneDB
--   service
@package hasbolt
@version 0.1.3.0

module Database.Bolt

-- | Monad Transformer to do all BOLT actions in
type BoltActionT = ReaderT Pipe

-- | Creates new <a>Pipe</a> instance to use all requests through
connect :: MonadIO m => BoltCfg -> m Pipe

-- | Closes <a>Pipe</a>
close :: MonadIO m => Pipe -> m ()

-- | Resets current sessions
reset :: MonadIO m => Pipe -> m ()

-- | Runs BOLT action on selected pipe
run :: Pipe -> BoltActionT m a -> m a

-- | Runs Cypher query with parameters and returns list of obtained
--   <a>Record</a>s. Strict version
queryP :: MonadIO m => Text -> Map Text Value -> BoltActionT m [Record]

-- | Runs Cypher query and returns list of obtained <a>Record</a>s. Strict
--   version
query :: MonadIO m => Text -> BoltActionT m [Record]

-- | Runs Cypher query with parameters and ignores response
queryP_ :: MonadIO m => Text -> Map Text Value -> BoltActionT m ()

-- | Runs Cypher query and ignores response
query_ :: MonadIO m => Text -> BoltActionT m ()
data Pipe

-- | Configuration of driver connection
data BoltCfg
BoltCfg :: Word32 -> Word32 -> Text -> Word16 -> Int -> String -> Int -> Text -> Text -> Bool -> BoltCfg

-- | '6060B017' value
[magic] :: BoltCfg -> Word32

-- | '00000001' value
[version] :: BoltCfg -> Word32

-- | Driver user agent
[userAgent] :: BoltCfg -> Text

-- | Maximum chunk size of request
[maxChunkSize] :: BoltCfg -> Word16

-- | Driver socket timeout
[socketTimeout] :: BoltCfg -> Int

-- | Neo4j server hostname
[host] :: BoltCfg -> String

-- | Neo4j server port
[port] :: BoltCfg -> Int

-- | Neo4j user
[user] :: BoltCfg -> Text

-- | Neo4j password
[password] :: BoltCfg -> Text

-- | Use TLS or not
[secure] :: BoltCfg -> Bool

-- | The <a>BoltValue</a> class describes values, that can be packed and
--   unpacked for BOLT protocol.
class BoltValue a

-- | Packs a value to <a>ByteString</a>
pack :: BoltValue a => a -> ByteString

-- | Unpacks in a State monad to get values from single <a>ByteString</a>
unpackT :: (BoltValue a, Monad m) => UnpackT m a

-- | Unpacks a <a>ByteString</a> to selected value
unpack :: (BoltValue a, Monad m) => ByteString -> m a

-- | The <a>Value</a> datatype generalizes all primitive <a>BoltValue</a>s
data Value
N :: () -> Value
B :: Bool -> Value
I :: Int -> Value
F :: Double -> Value
T :: Text -> Value
L :: [Value] -> Value
M :: (Map Text Value) -> Value
S :: Structure -> Value

-- | The <a>Structure</a> datatype describes Neo4j structure for BOLT
--   protocol
data Structure
Structure :: Word8 -> [Value] -> Structure
[signature] :: Structure -> Word8
[fields] :: Structure -> [Value]

-- | Result type for query requests
type Record = Map Text Value

-- | Get exact type from Value
class RecordValue a
exact :: (RecordValue a, Monad m) => Value -> m a
at :: Monad m => Record -> Text -> m Value
data Node
Node :: Int -> [Text] -> Map Text Value -> Node

-- | Neo4j node identifier
[nodeIdentity] :: Node -> Int

-- | Set of node labels (types)
[labels] :: Node -> [Text]

-- | Dict of node properties
[nodeProps] :: Node -> Map Text Value
data Relationship
Relationship :: Int -> Int -> Int -> Text -> Map Text Value -> Relationship

-- | Neo4j relationship identifier
[relIdentity] :: Relationship -> Int

-- | Identifier of start node
[startNodeId] :: Relationship -> Int

-- | Identifier of end node
[endNodeId] :: Relationship -> Int

-- | Relationship type
[relType] :: Relationship -> Text

-- | Dict of relationship properties
[relProps] :: Relationship -> Map Text Value
data URelationship
URelationship :: Int -> Text -> Map Text Value -> URelationship

-- | Neo4j relationship identifier
[urelIdentity] :: URelationship -> Int

-- | Relationship type
[urelType] :: URelationship -> Text

-- | Dict of relationship properties
[urelProps] :: URelationship -> Map Text Value
data Path
Path :: [Node] -> [URelationship] -> [Int] -> Path

-- | Chain of <a>Node</a>s in path
[pathNodes] :: Path -> [Node]

-- | Chain of <a>Relationship</a>s in path
[pathRelationships] :: Path -> [URelationship]

-- | Path sequence
[pathSequence] :: Path -> [Int]

module Database.Bolt.Lazy

-- | Monad Transformer to do all BOLT actions in
type BoltActionT = ReaderT Pipe

-- | Creates new <a>Pipe</a> instance to use all requests through
connect :: MonadIO m => BoltCfg -> m Pipe

-- | Closes <a>Pipe</a>
close :: MonadIO m => Pipe -> m ()

-- | Resets current sessions
reset :: MonadIO m => Pipe -> m ()

-- | Runs BOLT action on selected pipe
run :: Pipe -> BoltActionT m a -> m a

-- | Runs Cypher query with parameters and returns list of obtained
--   <a>Record</a>s. Lazy version
queryP :: MonadIO m => Text -> Map Text Value -> BoltActionT m [Record]

-- | Runs Cypher query and returns list of obtained <a>Record</a>s. Lazy
--   version
query :: MonadIO m => Text -> BoltActionT m [Record]

-- | Runs Cypher query with parameters and ignores response
queryP_ :: MonadIO m => Text -> Map Text Value -> BoltActionT m ()

-- | Runs Cypher query and ignores response
query_ :: MonadIO m => Text -> BoltActionT m ()
data Pipe

-- | Configuration of driver connection
data BoltCfg
BoltCfg :: Word32 -> Word32 -> Text -> Word16 -> Int -> String -> Int -> Text -> Text -> Bool -> BoltCfg

-- | '6060B017' value
[magic] :: BoltCfg -> Word32

-- | '00000001' value
[version] :: BoltCfg -> Word32

-- | Driver user agent
[userAgent] :: BoltCfg -> Text

-- | Maximum chunk size of request
[maxChunkSize] :: BoltCfg -> Word16

-- | Driver socket timeout
[socketTimeout] :: BoltCfg -> Int

-- | Neo4j server hostname
[host] :: BoltCfg -> String

-- | Neo4j server port
[port] :: BoltCfg -> Int

-- | Neo4j user
[user] :: BoltCfg -> Text

-- | Neo4j password
[password] :: BoltCfg -> Text

-- | Use TLS or not
[secure] :: BoltCfg -> Bool

-- | The <a>BoltValue</a> class describes values, that can be packed and
--   unpacked for BOLT protocol.
class BoltValue a

-- | Packs a value to <a>ByteString</a>
pack :: BoltValue a => a -> ByteString

-- | Unpacks in a State monad to get values from single <a>ByteString</a>
unpackT :: (BoltValue a, Monad m) => UnpackT m a

-- | Unpacks a <a>ByteString</a> to selected value
unpack :: (BoltValue a, Monad m) => ByteString -> m a

-- | The <a>Value</a> datatype generalizes all primitive <a>BoltValue</a>s
data Value
N :: () -> Value
B :: Bool -> Value
I :: Int -> Value
F :: Double -> Value
T :: Text -> Value
L :: [Value] -> Value
M :: (Map Text Value) -> Value
S :: Structure -> Value

-- | The <a>Structure</a> datatype describes Neo4j structure for BOLT
--   protocol
data Structure
Structure :: Word8 -> [Value] -> Structure
[signature] :: Structure -> Word8
[fields] :: Structure -> [Value]

-- | Result type for query requests
type Record = Map Text Value

-- | Get exact type from Value
class RecordValue a
exact :: (RecordValue a, Monad m) => Value -> m a
at :: Monad m => Record -> Text -> m Value
data Node
Node :: Int -> [Text] -> Map Text Value -> Node

-- | Neo4j node identifier
[nodeIdentity] :: Node -> Int

-- | Set of node labels (types)
[labels] :: Node -> [Text]

-- | Dict of node properties
[nodeProps] :: Node -> Map Text Value
data Relationship
Relationship :: Int -> Int -> Int -> Text -> Map Text Value -> Relationship

-- | Neo4j relationship identifier
[relIdentity] :: Relationship -> Int

-- | Identifier of start node
[startNodeId] :: Relationship -> Int

-- | Identifier of end node
[endNodeId] :: Relationship -> Int

-- | Relationship type
[relType] :: Relationship -> Text

-- | Dict of relationship properties
[relProps] :: Relationship -> Map Text Value
data URelationship
URelationship :: Int -> Text -> Map Text Value -> URelationship

-- | Neo4j relationship identifier
[urelIdentity] :: URelationship -> Int

-- | Relationship type
[urelType] :: URelationship -> Text

-- | Dict of relationship properties
[urelProps] :: URelationship -> Map Text Value
data Path
Path :: [Node] -> [URelationship] -> [Int] -> Path

-- | Chain of <a>Node</a>s in path
[pathNodes] :: Path -> [Node]

-- | Chain of <a>Relationship</a>s in path
[pathRelationships] :: Path -> [URelationship]

-- | Path sequence
[pathSequence] :: Path -> [Int]
