diff --git a/src/common/FakerMethods.ts b/src/common/FakerMethods.ts
index 128720c7..400d72ed 100644
--- a/src/common/FakerMethods.ts
+++ b/src/common/FakerMethods.ts
@@ -51,6 +51,7 @@ export default class {
{ name: 'collation', group: 'database', types: ['string'] },
{ name: 'engine', group: 'database', types: ['string'] },
+ { name: 'now', group: 'date', types: ['string', 'datetime'] },
{ name: 'past', group: 'date', types: ['string', 'datetime'] },
{ name: 'future', group: 'date', types: ['string', 'datetime'] },
// { name: 'between', group: 'date', types: ['string'] },
@@ -161,7 +162,9 @@ export default class {
{ name: 'filePath', group: 'system', types: ['string'] },
{ name: 'semver', group: 'system', types: ['string'] },
+ { name: 'now', group: 'time', types: ['string', 'time'] },
{ name: 'recent', group: 'time', types: ['string', 'time'] },
+ { name: 'random', group: 'time', types: ['string', 'time'] },
{ name: 'vehicle', group: 'vehicle', types: ['string'] },
{ name: 'manufacturer', group: 'vehicle', types: ['string'] },
diff --git a/src/common/interfaces/antares.ts b/src/common/interfaces/antares.ts
index 6855cbf7..45fc5ee7 100644
--- a/src/common/interfaces/antares.ts
+++ b/src/common/interfaces/antares.ts
@@ -363,8 +363,7 @@ export interface QueryBuilderObject {
offset: number;
join: string[];
update: string[];
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- insert: {[key: string]: any}[];
+ insert: {[key: string]: string | boolean | number }[];
delete: boolean;
}
diff --git a/src/common/libs/fakerCustom.ts b/src/common/libs/fakerCustom.ts
new file mode 100644
index 00000000..17e9b250
--- /dev/null
+++ b/src/common/libs/fakerCustom.ts
@@ -0,0 +1,17 @@
+import { faker } from '@faker-js/faker';
+import * as moment from 'moment';
+
+export const fakerCustom = {
+ seed: faker.seed,
+ setLocale: faker.setLocale,
+ ...faker,
+ date: {
+ now: () => moment().format('YYYY-MM-DD HH:mm:ss'),
+ ...faker.date
+ },
+ time: {
+ now: () => moment().format('HH:mm:ss'),
+ random: () => moment(faker.date.recent()).format('HH:mm:ss'),
+ ...faker.time
+ }
+};
diff --git a/src/main/ipc-handlers/tables.ts b/src/main/ipc-handlers/tables.ts
index d5221077..751846de 100644
--- a/src/main/ipc-handlers/tables.ts
+++ b/src/main/ipc-handlers/tables.ts
@@ -1,8 +1,8 @@
-import { faker } from '@faker-js/faker';
import customizations from 'common/customizations';
import { ARRAY, BIT, BLOB, BOOLEAN, DATE, DATETIME, FLOAT, LONG_TEXT, NUMBER, TEXT, TEXT_SEARCH } from 'common/fieldTypes';
import * as antares from 'common/interfaces/antares';
import { InsertRowsParams } from 'common/interfaces/tableApis';
+import { fakerCustom } from 'common/libs/fakerCustom';
import { sqlEscaper } from 'common/libs/sqlUtils';
import { ipcMain } from 'electron';
import * as fs from 'fs';
@@ -371,19 +371,19 @@ export default (connections: {[key: string]: antares.Client}) => {
let fakeValue;
if (params.locale)
- faker.locale = params.locale;
+ fakerCustom.locale = params.locale;
if (Object.keys(params.row[key].params).length) {
Object.keys(params.row[key].params).forEach(param => {
- if (!isNaN(params.row[key].params[param]))
- parsedParams[param] = +params.row[key].params[param];
+ if (!isNaN(params.row[key].params[param]))// Converts string numerics params to number
+ parsedParams[param] = Number(params.row[key].params[param]);
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- fakeValue = (faker as any)[params.row[key].group][params.row[key].method](parsedParams);
+ fakeValue = (fakerCustom as any)[params.row[key].group][params.row[key].method](parsedParams);
}
else
// eslint-disable-next-line @typescript-eslint/no-explicit-any
- fakeValue = (faker as any)[params.row[key].group][params.row[key].method]();
+ fakeValue = (fakerCustom as any)[params.row[key].group][params.row[key].method]();
if (typeof fakeValue === 'string') {
if (params.row[key].length)
diff --git a/src/renderer/components/WorkspaceTabQueryTable.vue b/src/renderer/components/WorkspaceTabQueryTable.vue
index 7d4d47e3..1b58191a 100644
--- a/src/renderer/components/WorkspaceTabQueryTable.vue
+++ b/src/renderer/components/WorkspaceTabQueryTable.vue
@@ -3,7 +3,7 @@
ref="tableWrapper"
class="vscroll no-outline"
tabindex="0"
- :style="{'height': resultsSize+'px'}"
+ :style="{ 'height': resultsSize + 'px' }"
@blur="deselectRows"
@focus="hasFocus = true"
@keyup.delete="showDeleteConfirmModal"
@@ -28,7 +28,7 @@
v-for="(result, index) in resultsWithRows"
:key="index"
class="tab-item"
- :class="{'active': resultsetIndex === index}"
+ :class="{ 'active': resultsetIndex === index }"
@click="selectResultset(index)"
>
{{ result.fields ? result.fields[0]?.table : '' }} ({{ result.rows.length }})
@@ -57,7 +57,7 @@
{{ field.alias || field.name }}