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

Function BsonValueInitIterator

pg_documentdb_core/src/io/pgbson.c:730–747  ·  view source on GitHub ↗

* Initializes a bson iterator from given array / document value at the root * of the buffer. */

Source from the content-addressed store, hash-verified

728 * of the buffer.
729 */
730void
731BsonValueInitIterator(const bson_value_t *value, bson_iter_t *iterator)
732{
733 if (value->value_type != BSON_TYPE_DOCUMENT && value->value_type != BSON_TYPE_ARRAY)
734 {
735 ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_BADVALUE),
736 errmsg(
737 "expected a document or array to init iterator, got %s",
738 BsonTypeName(value->value_type))));
739 }
740
741 if (!bson_iter_init_from_data(iterator, value->value.v_doc.data,
742 value->value.v_doc.data_len))
743 {
744 ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_BADVALUE),
745 errmsg("invalid input syntax for BSON")));
746 }
747}
748
749
750/* --------------------------------------------------------- */

Calls 1

BsonTypeNameFunction · 0.85

Tested by

no test coverage detected