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


-- | Parse and run JSONPath queries on Aeson documents
--   
--   RFC 9535 compliant JSONPath parsing and querying package. JSONPath is
--   similar to XPath for querying XML documents.
@package aeson-jsonpath
@version 0.3.0.2


-- | This module contains all the data structures related to JSONPath
module Data.Aeson.JSONPath.Types
data Query
Query :: QueryType -> [QuerySegment Query] -> Query
[queryType] :: Query -> QueryType
[querySegments] :: Query -> [QuerySegment Query]
data QueryType
Root :: QueryType
Current :: QueryType
data QueryState
QueryState :: Value -> Value -> (Query -> QueryState -> Vector Value) -> QueryState
[rootVal] :: QueryState -> Value
[curVal] :: QueryState -> Value
[executeQuery] :: QueryState -> Query -> QueryState -> Vector Value
data Segment a
Bracketed :: [Selector a] -> Segment a
Dotted :: Text -> Segment a
WildcardSegment :: Segment a
data QuerySegment a
QuerySegment :: SegmentType -> Segment a -> QuerySegment a
[segmentType] :: QuerySegment a -> SegmentType
[segment] :: QuerySegment a -> Segment a
data SegmentType
Child :: SegmentType
Descendant :: SegmentType
data Selector a
Name :: Text -> Selector a
Index :: Int -> Selector a
ArraySlice :: (Maybe Int, Maybe Int, Int) -> Selector a
Filter :: LogicalOrExpr a -> Selector a
WildcardSelector :: Selector a
data Literal
LitString :: Text -> Literal
LitNum :: Scientific -> Literal
LitBool :: Bool -> Literal
LitNull :: Literal
data BasicExpr a
Paren :: LogicalOrExpr a -> BasicExpr a
NotParen :: LogicalOrExpr a -> BasicExpr a
Test :: TestExpr a -> BasicExpr a
NotTest :: TestExpr a -> BasicExpr a
Comparison :: ComparisonExpr -> BasicExpr a
newtype LogicalOrExpr a
LogicalOr :: [LogicalAndExpr a] -> LogicalOrExpr a
newtype LogicalAndExpr a
LogicalAnd :: [BasicExpr a] -> LogicalAndExpr a
newtype TestExpr a
FilterQuery :: a -> TestExpr a
data ComparisonExpr
Comp :: Comparable -> ComparisonOp -> Comparable -> ComparisonExpr
data ComparisonOp
Less :: ComparisonOp
LessOrEqual :: ComparisonOp
Greater :: ComparisonOp
GreaterOrEqual :: ComparisonOp
Equal :: ComparisonOp
NotEqual :: ComparisonOp
data Comparable
CompLit :: Literal -> Comparable
CompSQ :: SingularQuery -> Comparable
data SingularQueryType
RootSQ :: SingularQueryType
CurrentSQ :: SingularQueryType
data SingularQuery
SingularQuery :: SingularQueryType -> [SingularQuerySegment] -> SingularQuery
[singularQueryType] :: SingularQuery -> SingularQueryType
[singularQuerySegments] :: SingularQuery -> [SingularQuerySegment]
data SingularQuerySegment
NameSQSeg :: Text -> SingularQuerySegment
IndexSQSeg :: Int -> SingularQuerySegment


-- | This module is responsible for executing the JSONPath query
module Data.Aeson.JSONPath.Query

-- | Runs the JSONPath Query
qQuery :: Query -> QueryState -> Vector Value

-- | Runs the JSONPath Query also returning node locations
qQueryLocated :: Query -> QueryState -> String -> Vector (String, Value)


-- | This module is responsible for parsing the JSONPath query
module Data.Aeson.JSONPath.Parser

-- | Query parser
pQuery :: Parser Query


-- | Run JSONPath queries on Aeson Values using methods exported in this
--   module.
module Data.Aeson.JSONPath

-- | Use when query string is not known at compile time
--   
--   <pre>
--   &gt;&gt;&gt; query "$.artist" json
--   Right [String "David Bowie"]
--   
--   &gt;&gt;&gt; query "$.art[ist" json
--   Left "failed to parse query: $.art[ist" (line 1, column 7)
--   </pre>
--   
--   For detailed usage examples, see:
--   <a>https://github.com/taimoorzaeem/aeson-jsonpath?tab=readme-ov-file#aeson-jsonpath</a>
query :: String -> Value -> Either ParseError (Vector Value)

-- | Use when query string is known at compile time
--   
--   <pre>
--   artist = queryQQ [jsonPath|$.artist|] json -- successfully compiles
--   
--   &gt;&gt;&gt; artist
--   [String "David Bowie"]
--   </pre>
--   
--   <pre>
--   artist = queryQQ [jsonPath|$.art[ist|] json -- fails at compilation time
--   </pre>
queryQQ :: Query -> Value -> Vector Value

-- | Get the location of the returned nodes along with the node
--   
--   <pre>
--   &gt;&gt;&gt; queryLocated "$.title" json
--   Right [("$['title']",String "Space Oddity")]
--   </pre>
queryLocated :: String -> Value -> Either ParseError (Vector (String, Value))

-- | Same as <a>queryLocated</a> but allows QuasiQuoter
--   
--   <pre>
--   artist = queryLocatedQQ [jsonPath|$.*|] json -- successfully compiles
--   
--   &gt;&gt;&gt; artist
--   [("$['artist']",String "David Bowie"),
--    ("$['title']",String "Space Oddity")]
--   </pre>
queryLocatedQQ :: Query -> Value -> Vector (String, Value)

-- | A <a>QuasiQuoter</a> for checking valid JSONPath syntax at compile
--   time
--   
--   <pre>
--   path :: Query
--   path = [jsonPath|$.store.records[0,1]|]
--   </pre>
jsonPath :: QuasiQuoter
