Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 321ddff

Browse files
author
Nikita Glukhov
committed
Add JsonValueInitDouble()
1 parent 143a5eb commit 321ddff

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/include/utils/json_generic.h

+9
Original file line numberDiff line numberDiff line change
@@ -436,6 +436,15 @@ JsonValueInitFloat(JsonbValue *jbv, float4 f)
436436
return jbv;
437437
}
438438

439+
static inline JsonbValue *
440+
JsonValueInitDouble(JsonbValue *jbv, float8 f)
441+
{
442+
jbv->type = jbvNumeric;
443+
jbv->val.numeric = DatumGetNumeric(DirectFunctionCall1(
444+
float8_numeric, Float8GetDatum(f)));
445+
return jbv;
446+
}
447+
439448
#define pushJsonbKey(pstate, jbv, key) \
440449
pushJsonbValue(pstate, WJB_KEY, JsonValueInitString(jbv, key))
441450

0 commit comments

Comments
 (0)