diff options
author | Robert Haas <rhaas@postgresql.org> | 2020-01-24 09:58:37 -0800 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2020-01-24 09:58:37 -0800 |
commit | ce0425b162d0a8c168e1fbab5324fb1cbca4b6b7 (patch) | |
tree | fcd8aa4030cc4b0b8b460a1f41c0aa7282d7e4c4 /src/include/utils/jsonapi.h | |
parent | d694e0bb793ebd6b392e6ef6a3b0a59ae66cbc95 (diff) | |
download | postgresql-ce0425b162d0a8c168e1fbab5324fb1cbca4b6b7.tar.gz postgresql-ce0425b162d0a8c168e1fbab5324fb1cbca4b6b7.zip |
Adjust src/include/utils/jsonapi.h so it's not backend-only.
The major change here is that we no longer include jsonb.h into
jsonapi.h. The reason that was necessary is that jsonapi.h included
several prototypes functions in jsonfuncs.c that depend on the Jsonb
type. Move those prototypes to a new header, jsonfuncs.h, and include
it where needed.
The other change is that JsonEncodeDateTime is now declared in
json.h rather than jsonapi.h.
Taken together, these steps eliminate all dependencies of jsonapi.h
on backend-only data types and header files, so that it can
potentially be included in frontend code.
Diffstat (limited to 'src/include/utils/jsonapi.h')
-rw-r--r-- | src/include/utils/jsonapi.h | 33 |
1 files changed, 0 insertions, 33 deletions
diff --git a/src/include/utils/jsonapi.h b/src/include/utils/jsonapi.h index f72f1cefd5f..11909474766 100644 --- a/src/include/utils/jsonapi.h +++ b/src/include/utils/jsonapi.h @@ -14,7 +14,6 @@ #ifndef JSONAPI_H #define JSONAPI_H -#include "jsonb.h" #include "lib/stringinfo.h" typedef enum @@ -132,36 +131,4 @@ extern JsonLexContext *makeJsonLexContextCstringLen(char *json, */ extern bool IsValidJsonNumber(const char *str, int len); -/* - * Flag types for iterate_json(b)_values to specify what elements from a - * json(b) document we want to iterate. - */ -typedef enum JsonToIndex -{ - jtiKey = 0x01, - jtiString = 0x02, - jtiNumeric = 0x04, - jtiBool = 0x08, - jtiAll = jtiKey | jtiString | jtiNumeric | jtiBool -} JsonToIndex; - -/* an action that will be applied to each value in iterate_json(b)_values functions */ -typedef void (*JsonIterateStringValuesAction) (void *state, char *elem_value, int elem_len); - -/* an action that will be applied to each value in transform_json(b)_values functions */ -typedef text *(*JsonTransformStringValuesAction) (void *state, char *elem_value, int elem_len); - -extern uint32 parse_jsonb_index_flags(Jsonb *jb); -extern void iterate_jsonb_values(Jsonb *jb, uint32 flags, void *state, - JsonIterateStringValuesAction action); -extern void iterate_json_values(text *json, uint32 flags, void *action_state, - JsonIterateStringValuesAction action); -extern Jsonb *transform_jsonb_string_values(Jsonb *jsonb, void *action_state, - JsonTransformStringValuesAction transform_action); -extern text *transform_json_string_values(text *json, void *action_state, - JsonTransformStringValuesAction transform_action); - -extern char *JsonEncodeDateTime(char *buf, Datum value, Oid typid, - const int *tzp); - #endif /* JSONAPI_H */ |