MCPcopy Create free account
hub / github.com/documentdb/documentdb / PgbsonToJsonForLogging

Function PgbsonToJsonForLogging

pg_documentdb_core/src/io/pgbson.c:214–226  ·  view source on GitHub ↗

* PgbsonToJsonForLogging converts a pgbson structure to an extended json syntax string. */

Source from the content-addressed store, hash-verified

212 * PgbsonToJsonForLogging converts a pgbson structure to an extended json syntax string.
213 */
214const char *
215PgbsonToJsonForLogging(const pgbson *bsonDocument)
216{
217 bson_t bson;
218 if (!bson_init_static(&bson, (uint8_t *) VARDATA_ANY(bsonDocument),
219 (uint32_t) VARSIZE_ANY_EXHDR(bsonDocument)))
220 {
221 ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_BADVALUE),
222 errmsg("invalid input syntax for BSON")));
223 }
224
225 return bson_as_relaxed_extended_json(&bson, NULL);
226}
227
228
229static const char *

Calls

no outgoing calls

Tested by

no test coverage detected