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

Function ConvertUint64ListToArray

pg_documentdb/src/metadata/index.c:1761–1783  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1759
1760
1761static ArrayType *
1762ConvertUint64ListToArray(List *collectionIdArray)
1763{
1764 int numCollections = list_length(collectionIdArray);
1765 Datum *collectionIdDatums = palloc0(sizeof(Datum) * numCollections);
1766
1767 int i = 0;
1768 uint64 collectionId;
1769 ListCell *cell;
1770 foreach(cell, collectionIdArray)
1771 {
1772 collectionId = *(uint64 *) lfirst(cell);
1773 collectionIdDatums[i] = Int64GetDatum(collectionId);
1774 i++;
1775 }
1776
1777 ArrayType *collectionIdArrayDatum = construct_array(collectionIdDatums,
1778 numCollections,
1779 INT8OID,
1780 sizeof(uint64), true,
1781 TYPALIGN_INT);
1782 return collectionIdArrayDatum;
1783}
1784
1785
1786/*

Callers 1

Calls 1

foreachFunction · 0.50

Tested by

no test coverage detected