Refactor binary data handling in SQL dumper and update test for binary insertion

This commit is contained in:
Stela Augustinova
2025-11-03 13:31:43 +01:00
parent 9c1819467a
commit d6ae3d4f16
2 changed files with 5 additions and 6 deletions

View File

@@ -78,7 +78,9 @@ export class SqlDumper implements AlterProcessor {
else if (_isNumber(value)) this.putRaw(value.toString());
else if (_isDate(value)) this.putStringValue(new Date(value).toISOString());
else if (value?.type == 'Buffer' && _isArray(value?.data)) this.putByteArrayValue(value?.data);
else if (value?.$binary) this.putByteArrayValue(Buffer.from(value?.$binary.base64, 'base64'));
else if (value?.$binary?.base64) {
this.putByteArrayValue(Array.from(Buffer.from(value.$binary.base64, 'base64')));
}
else if (value?.$bigint) this.putRaw(value?.$bigint);
else if (_isPlainObject(value) || _isArray(value)) this.putStringValue(JSON.stringify(value));
else this.put('^null');