1
1
mirror of https://github.com/Fabio286/antares.git synced 2025-06-05 21:59:22 +02:00

feat(PostgreSQL): UUID random generation option on UUID fields, closes #424

This commit is contained in:
2022-10-10 18:08:28 +02:00
parent 86e4c1d58f
commit a521274d01
4 changed files with 19 additions and 2 deletions

View File

@ -212,6 +212,7 @@ import {
DATETIME,
BLOB,
BIT,
BINARY,
HAS_TIMEZONE,
SPATIAL,
IS_MULTI_SPATIAL
@ -379,6 +380,9 @@ const editON = async (field: string) => {
const content = props.row[field];
const type = props.fields[field].type.toUpperCase();
if (BINARY.includes(type)) return;
originalContent.value = typeFormat(content, type, props.fields[field].length);
editingType.value = type;
editingField.value = field;
@ -582,6 +586,9 @@ const typeFormat = (val: string | number | Date | number[], type: string, precis
return parseInt(bitString).toString().padStart(Number(precision), '0');
}
if (BINARY.includes(type))
return Buffer.from(val as number[]).toString('hex');
if (ARRAY.includes(type)) {
if (Array.isArray(val))
return JSON.stringify(val).replaceAll('[', '{').replaceAll(']', '}');