upsertBatch method
Bulk upsert. The shim accepts a JSON array of point objects; this method composes that JSON internally so callers stay in Dart-land.
Implementation
Future<void> upsertBatch(
List<({String id, List<double> vector, Map<String, dynamic>? payload})>
points) async {
_checkOpen();
if (points.isEmpty) return;
final json = jsonEncode([
for (final p in points)
{
'id': p.id,
'vector': p.vector,
if (p.payload != null) 'payload': p.payload,
}
]);
final jsonPtr = json.toNativeUtf8();
final errorOut = calloc<Pointer<Utf8>>();
try {
final rc = _b.qe_shard_upsert_batch(
_shard,
jsonPtr.cast(),
errorOut.cast(),
);
if (rc != 0) {
throw QdrantException(
_consumeString(_b, errorOut) ?? 'qe_shard_upsert_batch rc=$rc');
}
} finally {
malloc.free(jsonPtr);
calloc.free(errorOut);
}
}