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

Function CreateConstFromBsonValue

pg_documentdb/src/query/query_operator.c:3434–3450  ·  view source on GitHub ↗

* CreateConstFromBsonValue returns a Const that mimics the output of bson_get_value. */

Source from the content-addressed store, hash-verified

3432 * CreateConstFromBsonValue returns a Const that mimics the output of bson_get_value.
3433 */
3434static Const *
3435CreateConstFromBsonValue(const char *path, const bson_value_t *value,
3436 const char *collationString)
3437{
3438 /* convert value to BSON Datum */
3439 pgbson_writer writer;
3440 PgbsonWriterInit(&writer);
3441 PgbsonWriterAppendValue(&writer, path, strlen(path), value);
3442
3443 if (IsCollationApplicable(collationString))
3444 {
3445 PgbsonWriterAppendUtf8(&writer, "collation", 9, collationString);
3446 }
3447
3448 pgbson *bson = PgbsonWriterGetPgbson(&writer);
3449 return MakeBsonConst(bson);
3450}
3451
3452
3453/*

Calls 6

PgbsonWriterInitFunction · 0.85
PgbsonWriterAppendValueFunction · 0.85
IsCollationApplicableFunction · 0.85
PgbsonWriterAppendUtf8Function · 0.85
PgbsonWriterGetPgbsonFunction · 0.85
MakeBsonConstFunction · 0.70

Tested by

no test coverage detected