-- 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
--   
--   
--   >>> query "$.artist" json
--   Right [String "David Bowie"]
--   
--   >>> query "$.art[ist" json
--   Left "failed to parse query: $.art[ist" (line 1, column 7)
--   
--   
--   For detailed usage examples, see:
--   https://github.com/taimoorzaeem/aeson-jsonpath?tab=readme-ov-file#aeson-jsonpath
query :: String -> Value -> Either ParseError (Vector Value)

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

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

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

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