mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-18 00:56:02 +00:00
Merge branch 'master' into feature/table-cell-data-view
This commit is contained in:
@@ -21,6 +21,7 @@ export function getFilterValueExpression(value, dataType?) {
|
|||||||
if (value === false) return 'FALSE';
|
if (value === false) return 'FALSE';
|
||||||
if (value.$oid) return `ObjectId("${value.$oid}")`;
|
if (value.$oid) return `ObjectId("${value.$oid}")`;
|
||||||
if (value.$bigint) return value.$bigint;
|
if (value.$bigint) return value.$bigint;
|
||||||
|
if (value.$decimal) return value.$decimal;
|
||||||
if (value.type == 'Buffer' && Array.isArray(value.data)) {
|
if (value.type == 'Buffer' && Array.isArray(value.data)) {
|
||||||
return '0x' + arrayToHexString(value.data);
|
return '0x' + arrayToHexString(value.data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ function isLike(value, test) {
|
|||||||
function extractRawValue(value) {
|
function extractRawValue(value) {
|
||||||
if (value?.$bigint) return value.$bigint;
|
if (value?.$bigint) return value.$bigint;
|
||||||
if (value?.$oid) return value.$oid;
|
if (value?.$oid) return value.$oid;
|
||||||
|
if (value?.$decimal) return value.$decimal;
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,7 @@ export class SqlDumper implements AlterProcessor {
|
|||||||
this.putByteArrayValue(bytes);
|
this.putByteArrayValue(bytes);
|
||||||
}
|
}
|
||||||
else if (value?.$bigint) this.putRaw(value?.$bigint);
|
else if (value?.$bigint) this.putRaw(value?.$bigint);
|
||||||
|
else if (value?.$decimal) this.putRaw(value?.$decimal);
|
||||||
else if (_isPlainObject(value) || _isArray(value)) this.putStringValue(JSON.stringify(value));
|
else if (_isPlainObject(value) || _isArray(value)) this.putStringValue(JSON.stringify(value));
|
||||||
else this.put('^null');
|
else this.put('^null');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,6 +272,13 @@ export function stringifyCellValue(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (value?.$decimal) {
|
||||||
|
return {
|
||||||
|
value: formatCellNumber(value.$decimal, gridFormattingOptions),
|
||||||
|
gridStyle: 'valueCellStyle',
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
if (editorTypes?.parseHexAsBuffer) {
|
if (editorTypes?.parseHexAsBuffer) {
|
||||||
// if (value?.type == 'Buffer' && _isArray(value.data)) {
|
// if (value?.type == 'Buffer' && _isArray(value.data)) {
|
||||||
// return { value: '0x' + arrayToHexString(value.data), gridStyle: 'valueCellStyle' };
|
// return { value: '0x' + arrayToHexString(value.data), gridStyle: 'valueCellStyle' };
|
||||||
@@ -465,6 +472,9 @@ export function shouldOpenMultilineDialog(value) {
|
|||||||
if (value?.$bigint) {
|
if (value?.$bigint) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (value?.$decimal) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
if (_isPlainObject(value) || _isArray(value)) {
|
if (_isPlainObject(value) || _isArray(value)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -715,6 +725,9 @@ export function deserializeJsTypesFromJsonParse(obj) {
|
|||||||
if (value?.$bigint) {
|
if (value?.$bigint) {
|
||||||
return BigInt(value.$bigint);
|
return BigInt(value.$bigint);
|
||||||
}
|
}
|
||||||
|
if (value?.$decimal) {
|
||||||
|
return value.$decimal;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -729,6 +742,9 @@ export function deserializeJsTypesReviver(key, value) {
|
|||||||
if (value?.$bigint) {
|
if (value?.$bigint) {
|
||||||
return BigInt(value.$bigint);
|
return BigInt(value.$bigint);
|
||||||
}
|
}
|
||||||
|
if (value?.$decimal) {
|
||||||
|
return value.$decimal;
|
||||||
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,7 @@
|
|||||||
$: style = computeStyle(maxWidth, col);
|
$: style = computeStyle(maxWidth, col);
|
||||||
|
|
||||||
$: isJson =
|
$: isJson =
|
||||||
_.isPlainObject(value) && !(value?.type == 'Buffer' && _.isArray(value.data)) && !value.$oid && !value.$bigint;
|
_.isPlainObject(value) && !(value?.type == 'Buffer' && _.isArray(value.data)) && !value.$oid && !value.$bigint && !value.$decimal;
|
||||||
|
|
||||||
// don't parse JSON for explicit data types
|
// don't parse JSON for explicit data types
|
||||||
$: jsonParsedValue = !editorTypes?.explicitDataType && isJsonLikeLongString(value) ? safeJsonParse(value) : null;
|
$: jsonParsedValue = !editorTypes?.explicitDataType && isJsonLikeLongString(value) ? safeJsonParse(value) : null;
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ export function countColumnSizes(grider: Grider, columns, containerWidth, displa
|
|||||||
if (_.isArray(value)) text = `[${value.length} items]`;
|
if (_.isArray(value)) text = `[${value.length} items]`;
|
||||||
else if (value?.$oid) text = `ObjectId("${value.$oid}")`;
|
else if (value?.$oid) text = `ObjectId("${value.$oid}")`;
|
||||||
else if (value?.$bigint) text = value.$bigint;
|
else if (value?.$bigint) text = value.$bigint;
|
||||||
|
else if (value?.$decimal) text = value.$decimal;
|
||||||
else if (isJsonLikeLongString(value) && safeJsonParse(value)) text = '(JSON)';
|
else if (isJsonLikeLongString(value) && safeJsonParse(value)) text = '(JSON)';
|
||||||
const width = context.measureText(typeof text == 'string' ? text.slice(0, MAX_GRID_TEXT_LENGTH) : text).width + 8;
|
const width = context.measureText(typeof text == 'string' ? text.slice(0, MAX_GRID_TEXT_LENGTH) : text).width + 8;
|
||||||
// console.log('colName', colName, text, width);
|
// console.log('colName', colName, text, width);
|
||||||
|
|||||||
@@ -26,8 +26,11 @@ pg.types.setTypeParser(1184, 'text', val => val); // timestamp
|
|||||||
pg.types.setTypeParser(20, 'text', val => {
|
pg.types.setTypeParser(20, 'text', val => {
|
||||||
const parsed = parseInt(val);
|
const parsed = parseInt(val);
|
||||||
if (Number.isSafeInteger(parsed)) return parsed;
|
if (Number.isSafeInteger(parsed)) return parsed;
|
||||||
return BigInt(val);
|
return { $bigint: val };
|
||||||
}); // timestamp
|
}); // timestamp
|
||||||
|
pg.types.setTypeParser(1700, 'text', val => {
|
||||||
|
return { $decimal: val };
|
||||||
|
}); // numeric
|
||||||
|
|
||||||
function extractGeographyDate(value) {
|
function extractGeographyDate(value) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user