Skip to content

Commit 258209e

Browse files
author
Nikita Glukhov
committed
Add JsonValueInitDouble()
1 parent 1c87221 commit 258209e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/include/utils/json_generic.h

Lines changed: 9 additions & 0 deletions
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy