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

Function index_spec_as_bson

pg_documentdb/src/metadata/index.c:153–168  ·  view source on GitHub ↗

* Takes an IndexSpec Datum (Composite type) and converts it to a serialized * BSON format. Supports two ways of serializing it: * 1) GetIndexes - converts it to a format that the wire protocol "list_indexes" command needs * 2) CreateIndexes - converts to a format that create_indexes needs (used in shard_collection) * or similar scenarios. */

Source from the content-addressed store, hash-verified

151 * or similar scenarios.
152 */
153Datum
154index_spec_as_bson(PG_FUNCTION_ARGS)
155{
156 IndexSpec *indexSpec = DatumGetIndexSpec(ExpandedRecordGetDatum(
157 PG_GETARG_EXPANDED_RECORD(0)));
158 bool isGetIndexes = PG_GETARG_BOOL(1);
159
160 char *namespaceName = NULL;
161 if (!PG_ARGISNULL(2))
162 {
163 namespaceName = text_to_cstring(PG_GETARG_TEXT_P(2));
164 }
165
166 pgbson *result = SerializeIndexSpec(indexSpec, isGetIndexes, namespaceName);
167 PG_RETURN_POINTER(result);
168}
169
170
171/*

Callers

nothing calls this directly

Calls 2

DatumGetIndexSpecFunction · 0.85
SerializeIndexSpecFunction · 0.85

Tested by

no test coverage detected