Skip to content

Commit a0bbab2

Browse files
committed
Support trimFactor range option
1 parent d9a4678 commit a0bbab2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/MongoDB/ClientEncryption.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -850,6 +850,17 @@ static mongoc_client_encryption_encrypt_range_opts_t* phongo_clientencryption_en
850850
return opts;
851851
}
852852

853+
if (php_array_existsc(options, "trimFactor")) {
854+
int64_t trimfactor = php_array_fetchc_long(options, "trimFactor");
855+
856+
if (trimfactor < 0 || trimfactor > INT32_MAX) {
857+
phongo_throw_exception(PHONGO_ERROR_INVALID_ARGUMENT, "Expected \"trimFactor\" range option to be a positive 32-bit integer, %" PRId64 " given", trimfactor);
858+
goto cleanup;
859+
}
860+
861+
mongoc_client_encryption_encrypt_range_opts_set_trim_factor(opts, (int32_t) trimfactor);
862+
}
863+
853864
if (php_array_existsc(options, "sparsity")) {
854865
int64_t sparsity = php_array_fetchc_long(options, "sparsity");
855866

0 commit comments

Comments
 (0)