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

Function bsonsequence_get_bson

pg_documentdb_core/src/io/pgbsonsequence.c:160–184  ·  view source on GitHub ↗

* Gets the set of documents that are serialized by the bsonsequence. */

Source from the content-addressed store, hash-verified

158 * Gets the set of documents that are serialized by the bsonsequence.
159 */
160Datum
161bsonsequence_get_bson(PG_FUNCTION_ARGS)
162{
163 pgbsonsequence *sequence = PG_GETARG_PGBSON_SEQUENCE(0);
164 TupleDesc descriptor;
165 Tuplestorestate *tupleStore = SetupBsonTuplestore(fcinfo, &descriptor);
166
167 List *docsList = PgbsonSequenceGetDocumentBsonValues(sequence);
168
169
170 ListCell *cell;
171 foreach(cell, docsList)
172 {
173 const bson_value_t *docValue = lfirst(cell);
174 Datum values[1];
175 bool nulls[1];
176
177 values[0] = PointerGetDatum(PgbsonInitFromDocumentBsonValue(docValue));
178 nulls[0] = false;
179
180 tuplestore_putvalues(tupleStore, descriptor, values, nulls);
181 }
182
183 PG_RETURN_VOID();
184}
185
186
187/*

Callers

nothing calls this directly

Calls 4

SetupBsonTuplestoreFunction · 0.85
foreachFunction · 0.50

Tested by

no test coverage detected