@@ -434,6 +434,53 @@ JsonValueInitFloat(JsonbValue *jbv, float4 f)
434434 return jbv ;
435435}
436436
437+ #define pushJsonbKey (pstate , jbv , key ) \
438+ pushJsonbValue(pstate, WJB_KEY, JsonValueInitString(jbv, key))
439+
440+ #define pushJsonbValueGeneric (Type , pstate , jbv , val ) \
441+ pushJsonbValue(pstate, WJB_VALUE, JsonValueInit##Type(jbv, val))
442+
443+ #define pushJsonbElemGeneric (Type , pstate , jbv , val ) \
444+ pushJsonbValue(pstate, WJB_ELEM, JsonValueInit##Type(jbv, val))
445+
446+ #define pushJsonbValueInteger (pstate , jbv , i ) \
447+ pushJsonbValueGeneric(Integer, pstate, jbv, i)
448+
449+ #define pushJsonbValueFloat (pstate , jbv , f ) \
450+ pushJsonbValueGeneric(Float, pstate, jbv, f)
451+
452+ #define pushJsonbElemFloat (pstate , jbv , f ) \
453+ pushJsonbElemGeneric(Float, pstate, jbv, f)
454+
455+ #define pushJsonbElemString (pstate , jbv , txt ) \
456+ pushJsonbElemGeneric(String, pstate, jbv, txt)
457+
458+ #define pushJsonbElemText (pstate , jbv , txt ) \
459+ pushJsonbElemGeneric(Text, pstate, jbv, txt)
460+
461+ #define pushJsonbElemNumeric (pstate , jbv , num ) \
462+ pushJsonbElemGeneric(Numeric, pstate, jbv, num)
463+
464+ #define pushJsonbElemInteger (pstate , jbv , num ) \
465+ pushJsonbElemGeneric(Integer, pstate, jbv, num)
466+
467+ #define pushJsonbElemBinary (pstate , jbv , jbcont ) \
468+ pushJsonbElemGeneric(Binary, pstate, jbv, jbcont)
469+
470+ #define pushJsonbKeyValueGeneric (Type , pstate , jbv , key , val ) ( \
471+ pushJsonbKey(pstate, jbv, key), \
472+ pushJsonbValueGeneric(Type, pstate, jbv, val) \
473+ )
474+
475+ #define pushJsonbKeyValueString (pstate , jbv , key , val ) \
476+ pushJsonbKeyValueGeneric(String, pstate, jbv, key, val)
477+
478+ #define pushJsonbKeyValueFloat (pstate , jbv , key , val ) \
479+ pushJsonbKeyValueGeneric(Float, pstate, jbv, key, val)
480+
481+ #define pushJsonbKeyValueInteger (pstate , jbv , key , val ) \
482+ pushJsonbKeyValueGeneric(Integer, pstate, jbv, key, val)
483+
437484extern Json * JsonValueToJson (JsonValue * val );
438485extern JsonValue * JsonToJsonValue (Json * json , JsonValue * jv );
439486extern JsonValue * JsonValueUnpackBinary (const JsonValue * jbv );
0 commit comments