summaryrefslogtreecommitdiff
path: root/jsonpath.h
diff options
context:
space:
mode:
Diffstat (limited to 'jsonpath.h')
-rw-r--r--jsonpath.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/jsonpath.h b/jsonpath.h
index 3d873ed..4be498d 100644
--- a/jsonpath.h
+++ b/jsonpath.h
@@ -3,6 +3,16 @@
* jsonpath.h
* JSONPath implementation routines for JSON data type support.
*
+ * The "JSONPath" implemented here is similar to, but not exactly the same as,
+ * the JSONPath described at http://goessner.net/articles/JsonPath/ .
+ * The main differences are stronger subscripting rules, special methods
+ * via function-call notation (currently, the only one provided is .char()),
+ * and that the '$' at the beginning of a JSONPath expression is optional.
+ * Also, array indices as a set (e.g. [0,1]) and filters/scripts are currently
+ * not implemented. Array indices are a planned feature. True filters
+ * would require an honest-to-goodness JavaScript engine, so perhaps
+ * someone will write a module for that in the future.
+ *
* Copyright (c) 2010, PostgreSQL Global Development Group
* Written by Joey Adams <joeyadams3.14159@gmail.com>.
*
@@ -25,6 +35,13 @@ typedef enum
JP_CALL_CHAR
} jp_element_type;
+/*
+ * A jp_element is a single piece of a JSONPath expression
+ * (e.g. [3], .foo, .char(3), ..*). It represents subscripting
+ * down one level in a JSON tree, or invoking a special method
+ * (like .char() ). However, if recursive_descent is set to true,
+ * the subscript applies to a value and all of its descendants.
+ */
typedef struct
{
jp_element_type type;
@@ -49,6 +66,13 @@ typedef enum
JP_REF_CHAR
} JPRefType;
+/*
+ * A JPRef is a reference to some part of a JSON tree,
+ * typically a value (but not always).
+ *
+ * JPRef* is really a "subclass" of JSON* . In the future, this structure
+ * will likely be merged into the JSON structure to improve performance.
+ */
typedef struct
{
JPRefType type;