tspace-mysql 1.9.0 → 1.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4357 -133
- package/dist/lib/config/index.d.ts +2 -2
- package/dist/lib/config/index.js +24 -16
- package/dist/lib/config/index.js.map +1 -1
- package/dist/lib/constants/index.d.ts +10 -1
- package/dist/lib/constants/index.js +11 -2
- package/dist/lib/constants/index.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractBuilder.d.ts +11 -7
- package/dist/lib/core/Abstracts/AbstractBuilder.js +11 -13
- package/dist/lib/core/Abstracts/AbstractBuilder.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractDB.d.ts +4 -1
- package/dist/lib/core/Abstracts/AbstractDB.js.map +1 -1
- package/dist/lib/core/Abstracts/AbstractView.js.map +1 -1
- package/dist/lib/core/Blueprint.d.ts +30 -10
- package/dist/lib/core/Blueprint.js +39 -14
- package/dist/lib/core/Blueprint.js.map +1 -1
- package/dist/lib/core/Builder.d.ts +263 -9
- package/dist/lib/core/Builder.js +610 -347
- package/dist/lib/core/Builder.js.map +1 -1
- package/dist/lib/core/Cache/DBCache.js +19 -20
- package/dist/lib/core/Cache/DBCache.js.map +1 -1
- package/dist/lib/core/Cache/MemoryCache.js +3 -3
- package/dist/lib/core/Cache/MemoryCache.js.map +1 -1
- package/dist/lib/core/Cache/RedisCache.js +27 -17
- package/dist/lib/core/Cache/RedisCache.js.map +1 -1
- package/dist/lib/core/Cache/index.js +5 -4
- package/dist/lib/core/Cache/index.js.map +1 -1
- package/dist/lib/core/Contracts/AlterTable.d.ts +152 -0
- package/dist/lib/core/Contracts/AlterTable.js +243 -0
- package/dist/lib/core/Contracts/AlterTable.js.map +1 -0
- package/dist/lib/core/Contracts/Audit.js +2 -5
- package/dist/lib/core/Contracts/Audit.js.map +1 -1
- package/dist/lib/core/DB.d.ts +101 -9
- package/dist/lib/core/DB.js +168 -29
- package/dist/lib/core/DB.js.map +1 -1
- package/dist/lib/core/Decorator.d.ts +144 -16
- package/dist/lib/core/Decorator.js +156 -14
- package/dist/lib/core/Decorator.js.map +1 -1
- package/dist/lib/core/Driver/index.d.ts +43 -9
- package/dist/lib/core/Driver/index.js +9 -7
- package/dist/lib/core/Driver/index.js.map +1 -1
- package/dist/lib/core/Driver/mariadb/MariadbDriver.js +74 -27
- package/dist/lib/core/Driver/mariadb/MariadbDriver.js.map +1 -1
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.d.ts +45 -9
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.js +165 -21
- package/dist/lib/core/Driver/mariadb/MariadbQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/mongodb/MongodbDriver.d.ts +24 -0
- package/dist/lib/core/Driver/mongodb/MongodbDriver.js +255 -0
- package/dist/lib/core/Driver/mongodb/MongodbDriver.js.map +1 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.d.ts +141 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.js +563 -0
- package/dist/lib/core/Driver/mongodb/MongodbQueryBuilder.js.map +1 -0
- package/dist/lib/core/Driver/mysql/MysqlDriver.js +105 -95
- package/dist/lib/core/Driver/mysql/MysqlDriver.js.map +1 -1
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.d.ts +45 -9
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.js +165 -21
- package/dist/lib/core/Driver/mysql/MysqlQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/postgres/PostgresDriver.js +97 -72
- package/dist/lib/core/Driver/postgres/PostgresDriver.js.map +1 -1
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.d.ts +50 -9
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.js +296 -41
- package/dist/lib/core/Driver/postgres/PostgresQueryBuilder.js.map +1 -1
- package/dist/lib/core/Driver/sqlite/SqliteDriver.d.ts +20 -0
- package/dist/lib/core/Driver/sqlite/SqliteDriver.js +192 -0
- package/dist/lib/core/Driver/sqlite/SqliteDriver.js.map +1 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.d.ts +144 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.js +689 -0
- package/dist/lib/core/Driver/sqlite/SqliteQueryBuilder.js.map +1 -0
- package/dist/lib/core/JoinModel.js +2 -2
- package/dist/lib/core/JoinModel.js.map +1 -1
- package/dist/lib/core/Meta.d.ts +17 -11
- package/dist/lib/core/Meta.js +25 -19
- package/dist/lib/core/Meta.js.map +1 -1
- package/dist/lib/core/Model.d.ts +450 -108
- package/dist/lib/core/Model.js +1031 -587
- package/dist/lib/core/Model.js.map +1 -1
- package/dist/lib/{tools/index.d.ts → core/Package.d.ts} +11 -3
- package/dist/lib/{tools/index.js → core/Package.js} +20 -7
- package/dist/lib/core/Package.js.map +1 -0
- package/dist/lib/core/Pool.js +42 -30
- package/dist/lib/core/Pool.js.map +1 -1
- package/dist/lib/core/Queue.d.ts +240 -0
- package/dist/lib/core/Queue.js +686 -0
- package/dist/lib/core/Queue.js.map +1 -0
- package/dist/lib/core/RelationManager.js +27 -25
- package/dist/lib/core/RelationManager.js.map +1 -1
- package/dist/lib/core/Repository.d.ts +73 -207
- package/dist/lib/core/Repository.js +120 -235
- package/dist/lib/core/Repository.js.map +1 -1
- package/dist/lib/core/Schema.d.ts +218 -0
- package/dist/lib/core/Schema.js +370 -65
- package/dist/lib/core/Schema.js.map +1 -1
- package/dist/lib/core/StateManager.d.ts +25 -12
- package/dist/lib/core/StateManager.js +10 -5
- package/dist/lib/core/StateManager.js.map +1 -1
- package/dist/lib/core/UtilityTypes.d.ts +85 -56
- package/dist/lib/core/UtilityTypes.js.map +1 -1
- package/dist/lib/core/index.d.ts +4 -0
- package/dist/lib/core/index.js +6 -2
- package/dist/lib/core/index.js.map +1 -1
- package/dist/lib/types/decorator/index.d.ts +1 -1
- package/dist/lib/types/index.d.ts +69 -22
- package/dist/lib/types/repository/index.d.ts +68 -37
- package/dist/lib/utils/index.d.ts +11 -1
- package/dist/lib/utils/index.js +58 -2
- package/dist/lib/utils/index.js.map +1 -1
- package/package.json +14 -6
- package/dist/lib/tools/index.js.map +0 -1
|
@@ -3,7 +3,7 @@ import { DB } from "./DB";
|
|
|
3
3
|
import { Join } from "./Join";
|
|
4
4
|
import { CONSTANTS } from "../constants";
|
|
5
5
|
import { QueryBuilder } from "./Driver";
|
|
6
|
-
import { TPagination, TConnectionOptions, TPoolConnected, TConnectionTransaction } from "../types";
|
|
6
|
+
import { TPagination, TConnectionOptions, TPoolConnected, TConnectionTransaction, TDriver } from "../types";
|
|
7
7
|
declare class Builder extends AbstractBuilder {
|
|
8
8
|
constructor();
|
|
9
9
|
/**
|
|
@@ -14,21 +14,70 @@ declare class Builder extends AbstractBuilder {
|
|
|
14
14
|
static get instance(): Builder;
|
|
15
15
|
/**
|
|
16
16
|
* The 'driver' method is used to get current driver
|
|
17
|
-
* @returns {
|
|
17
|
+
* @returns {TDriver} driver
|
|
18
18
|
*/
|
|
19
|
-
driver():
|
|
19
|
+
driver(): TDriver;
|
|
20
20
|
/**
|
|
21
21
|
* The 'database' method is used to get current database
|
|
22
22
|
* @returns {string} database
|
|
23
23
|
*/
|
|
24
24
|
database(): string;
|
|
25
25
|
/**
|
|
26
|
-
* The 'rowLock' method is used to row level locks
|
|
26
|
+
* The 'rowLock' method is used to row level locks (`FOR UPDATE` or `FOR SHARE`) to the query.
|
|
27
27
|
*
|
|
28
28
|
* @param {string} mode
|
|
29
29
|
* @returns {this} this
|
|
30
30
|
*/
|
|
31
|
-
rowLock(mode: "FOR_UPDATE" | "FOR_SHARE"
|
|
31
|
+
rowLock(mode: "FOR_UPDATE" | "FOR_SHARE", opts?: {
|
|
32
|
+
skipLocked?: boolean;
|
|
33
|
+
nowait?: boolean;
|
|
34
|
+
}): this;
|
|
35
|
+
/**
|
|
36
|
+
* The 'forUpdate' method is used to applies a row-level exclusive lock (`FOR UPDATE`) to the query.
|
|
37
|
+
*
|
|
38
|
+
* This lock prevents other transactions from modifying or acquiring
|
|
39
|
+
* conflicting locks on the selected rows until the current transaction
|
|
40
|
+
* is committed or rolled back.
|
|
41
|
+
*
|
|
42
|
+
* Commonly used in queue systems or critical sections to safely
|
|
43
|
+
* select and update rows without race conditions.
|
|
44
|
+
*
|
|
45
|
+
* @param {Object} [opts] - Locking options
|
|
46
|
+
* @param {boolean} [opts.skipLocked=false] - If true, skips rows that are already locked by other transactions.
|
|
47
|
+
* Useful for building non-blocking workers (e.g., job queues).
|
|
48
|
+
* @param {boolean} [opts.nowait=false] - If true, throws an error immediately if the lock cannot be acquired.
|
|
49
|
+
*
|
|
50
|
+
* @throws {Error} If both `skipLocked` and `nowait` are enabled at the same time.
|
|
51
|
+
*
|
|
52
|
+
* @returns {this} Returns the query builder instance for chaining.
|
|
53
|
+
*/
|
|
54
|
+
forUpdate(opts?: {
|
|
55
|
+
skipLocked?: boolean;
|
|
56
|
+
nowait?: boolean;
|
|
57
|
+
}): this;
|
|
58
|
+
/**
|
|
59
|
+
* The 'forShare' method is used to applies a row-level exclusive lock (`FOR SHARE`) to the query.
|
|
60
|
+
*
|
|
61
|
+
* This lock prevents other transactions from modifying or acquiring
|
|
62
|
+
* conflicting locks on the selected rows until the current transaction
|
|
63
|
+
* is committed or rolled back.
|
|
64
|
+
*
|
|
65
|
+
* Commonly used in queue systems or critical sections to safely
|
|
66
|
+
* select and update rows without race conditions.
|
|
67
|
+
*
|
|
68
|
+
* @param {Object} [opts] - Locking options
|
|
69
|
+
* @param {boolean} [opts.skipLocked=false] - If true, skips rows that are already locked by other transactions.
|
|
70
|
+
* Useful for building non-blocking workers (e.g., job queues).
|
|
71
|
+
* @param {boolean} [opts.nowait=false] - If true, throws an error immediately if the lock cannot be acquired.
|
|
72
|
+
*
|
|
73
|
+
* @throws {Error} If both `skipLocked` and `nowait` are enabled at the same time.
|
|
74
|
+
*
|
|
75
|
+
* @returns {this} Returns the query builder instance for chaining.
|
|
76
|
+
*/
|
|
77
|
+
forShare(opts?: {
|
|
78
|
+
skipLocked?: boolean;
|
|
79
|
+
nowait?: boolean;
|
|
80
|
+
}): this;
|
|
32
81
|
/**
|
|
33
82
|
* The 'unset' method is used to drop a property as desired.
|
|
34
83
|
* @param {object} options
|
|
@@ -1162,6 +1211,40 @@ declare class Builder extends AbstractBuilder {
|
|
|
1162
1211
|
ParentTable: string;
|
|
1163
1212
|
ParentColumn: string;
|
|
1164
1213
|
}[]>;
|
|
1214
|
+
/**
|
|
1215
|
+
* Adds a foreign key constraint to a table.
|
|
1216
|
+
*
|
|
1217
|
+
* This method checks whether the specified foreign key constraint already exists
|
|
1218
|
+
* on the table before attempting to create it. If the constraint exists, an error
|
|
1219
|
+
* will be thrown to prevent duplication.
|
|
1220
|
+
*
|
|
1221
|
+
* @async
|
|
1222
|
+
* @method addFK
|
|
1223
|
+
* @param {Object} params - Parameters for creating the foreign key.
|
|
1224
|
+
* @param {string} params.table - The name of the table where the foreign key will be added.
|
|
1225
|
+
* @param {string} params.tableRef - The referenced table name.
|
|
1226
|
+
* @param {string} params.key - The column in the current table that will act as the foreign key.
|
|
1227
|
+
* @param {string} params.constraint - The name of the foreign key constraint.
|
|
1228
|
+
* @param {Object} params.foreign - Foreign key configuration.
|
|
1229
|
+
* @param {string} params.foreign.references - The referenced column in the referenced table.
|
|
1230
|
+
* @param {string} params.foreign.onDelete - Action when a referenced row is deleted (e.g. CASCADE, SET NULL).
|
|
1231
|
+
* @param {string} params.foreign.onUpdate - Action when a referenced row is updated (e.g. CASCADE, RESTRICT).
|
|
1232
|
+
*
|
|
1233
|
+
* @throws {Error} If the specified foreign key constraint already exists.
|
|
1234
|
+
*
|
|
1235
|
+
* @returns {Promise<void>} Resolves when the foreign key constraint is successfully created.
|
|
1236
|
+
*/
|
|
1237
|
+
addFK({ table, tableRef, key, constraint, foreign }: {
|
|
1238
|
+
table: string;
|
|
1239
|
+
tableRef: string;
|
|
1240
|
+
key: string;
|
|
1241
|
+
constraint: string;
|
|
1242
|
+
foreign: {
|
|
1243
|
+
references: string;
|
|
1244
|
+
onDelete: string;
|
|
1245
|
+
onUpdate: string;
|
|
1246
|
+
};
|
|
1247
|
+
}): Promise<void>;
|
|
1165
1248
|
/**
|
|
1166
1249
|
* The `dropFK` method is used to remove a foreign key constraint from the database.
|
|
1167
1250
|
* If a table name is provided, the constraint will be dropped from that table;
|
|
@@ -1208,10 +1291,172 @@ declare class Builder extends AbstractBuilder {
|
|
|
1208
1291
|
* @returns {Promise<boolean>}
|
|
1209
1292
|
*
|
|
1210
1293
|
*/
|
|
1211
|
-
hasIndex({
|
|
1212
|
-
|
|
1294
|
+
hasIndex({ name, table }: {
|
|
1295
|
+
name: string;
|
|
1296
|
+
table?: string;
|
|
1297
|
+
}): Promise<boolean>;
|
|
1298
|
+
/**
|
|
1299
|
+
* Adds an index to a table.
|
|
1300
|
+
*
|
|
1301
|
+
* This method checks whether the specified index already exists on the table
|
|
1302
|
+
* before attempting to create it. If the index exists, an error will be thrown
|
|
1303
|
+
* to prevent duplication.
|
|
1304
|
+
*
|
|
1305
|
+
* @async
|
|
1306
|
+
* @method addIndex
|
|
1307
|
+
* @param {Object} params - Parameters for creating the index.
|
|
1308
|
+
* @param {string} params.name - The name of the index.
|
|
1309
|
+
* @param {string} [params.table] - The table where the index will be created. Defaults to the current model table.
|
|
1310
|
+
* @param {string[]} params.columns - The columns included in the index.
|
|
1311
|
+
*
|
|
1312
|
+
* @throws {Error} If the specified index already exists.
|
|
1313
|
+
*
|
|
1314
|
+
* @returns {Promise<void>} Resolves when the index has been successfully created.
|
|
1315
|
+
*/
|
|
1316
|
+
addIndex({ name, table, columns }: {
|
|
1317
|
+
name: string;
|
|
1318
|
+
table?: string;
|
|
1319
|
+
columns: string[];
|
|
1320
|
+
}): Promise<void>;
|
|
1321
|
+
/**
|
|
1322
|
+
* Drops an index from a table.
|
|
1323
|
+
*
|
|
1324
|
+
* This method checks whether the specified index exists on the table
|
|
1325
|
+
* before attempting to drop it. If the index does not exist, an error
|
|
1326
|
+
* will be thrown.
|
|
1327
|
+
*
|
|
1328
|
+
* @async
|
|
1329
|
+
* @method dropIndex
|
|
1330
|
+
* @param {Object} params - Parameters for dropping the index.
|
|
1331
|
+
* @param {string} params.name - The name of the index to drop.
|
|
1332
|
+
* @param {string} [params.table] - The table from which the index will be removed. Defaults to the current model table.
|
|
1333
|
+
*
|
|
1334
|
+
* @throws {Error} If the specified index was not found.
|
|
1335
|
+
*
|
|
1336
|
+
* @returns {Promise<void>} Resolves when the index has been successfully dropped.
|
|
1337
|
+
*/
|
|
1338
|
+
dropIndex({ name, table }: {
|
|
1339
|
+
name: string;
|
|
1340
|
+
table?: string;
|
|
1341
|
+
}): Promise<void>;
|
|
1342
|
+
/**
|
|
1343
|
+
* Checks whether a unique constraint exists on a table.
|
|
1344
|
+
*
|
|
1345
|
+
* This method queries the database metadata to determine if the specified
|
|
1346
|
+
* unique constraint exists on the given table.
|
|
1347
|
+
*
|
|
1348
|
+
* @async
|
|
1349
|
+
* @method hasUnique
|
|
1350
|
+
* @param {Object} params - Parameters for checking the unique constraint.
|
|
1351
|
+
* @param {string} params.name - The name of the unique constraint.
|
|
1352
|
+
* @param {string} [params.table] - The table to check. Defaults to the current model table.
|
|
1353
|
+
*
|
|
1354
|
+
* @returns {Promise<boolean>} Returns `true` if the unique constraint exists, otherwise `false`.
|
|
1355
|
+
*/
|
|
1356
|
+
hasUnique({ name, table }: {
|
|
1357
|
+
name: string;
|
|
1358
|
+
table?: string;
|
|
1359
|
+
}): Promise<boolean>;
|
|
1360
|
+
/**
|
|
1361
|
+
* Adds a unique constraint to a table.
|
|
1362
|
+
*
|
|
1363
|
+
* This method checks whether the specified unique constraint already exists
|
|
1364
|
+
* on the table before attempting to create it. If the constraint already exists,
|
|
1365
|
+
* an error will be thrown to prevent duplication.
|
|
1366
|
+
*
|
|
1367
|
+
* @async
|
|
1368
|
+
* @method addUnique
|
|
1369
|
+
* @param {Object} params - Parameters for creating the unique constraint.
|
|
1370
|
+
* @param {string} params.name - The name of the unique constraint.
|
|
1371
|
+
* @param {string} [params.table] - The table where the unique constraint will be added. Defaults to the current model table.
|
|
1372
|
+
* @param {string[]} params.columns - The columns that will be included in the unique constraint.
|
|
1373
|
+
*
|
|
1374
|
+
* @throws {Error} If the specified unique constraint already exists.
|
|
1375
|
+
*
|
|
1376
|
+
* @returns {Promise<void>} Resolves when the unique constraint has been successfully created.
|
|
1377
|
+
*/
|
|
1378
|
+
addUnique({ name, table, columns }: {
|
|
1379
|
+
name: string;
|
|
1380
|
+
table?: string;
|
|
1381
|
+
columns: string[];
|
|
1382
|
+
}): Promise<void>;
|
|
1383
|
+
/**
|
|
1384
|
+
* Drops a unique constraint from a table.
|
|
1385
|
+
*
|
|
1386
|
+
* This method checks whether the specified unique constraint exists
|
|
1387
|
+
* on the table before attempting to remove it. If the constraint does
|
|
1388
|
+
* not exist, an error will be thrown.
|
|
1389
|
+
*
|
|
1390
|
+
* @async
|
|
1391
|
+
* @method dropUnique
|
|
1392
|
+
* @param {Object} params - Parameters for dropping the unique constraint.
|
|
1393
|
+
* @param {string} params.name - The name of the unique constraint to drop.
|
|
1394
|
+
* @param {string} [params.table] - The table from which the unique constraint will be removed. Defaults to the current model table.
|
|
1395
|
+
*
|
|
1396
|
+
* @throws {Error} If the specified unique constraint was not found.
|
|
1397
|
+
*
|
|
1398
|
+
* @returns {Promise<void>} Resolves when the unique constraint has been successfully dropped.
|
|
1399
|
+
*/
|
|
1400
|
+
dropUnique({ name, table }: {
|
|
1401
|
+
name: string;
|
|
1402
|
+
table?: string;
|
|
1403
|
+
}): Promise<void>;
|
|
1404
|
+
/**
|
|
1405
|
+
* Checks whether a primary key constraint exists on a table.
|
|
1406
|
+
*
|
|
1407
|
+
* This method queries the database metadata to determine if the specified
|
|
1408
|
+
* table contains a primary key constraint.
|
|
1409
|
+
*
|
|
1410
|
+
* @async
|
|
1411
|
+
* @method hasPrimaryKey
|
|
1412
|
+
* @param {Object} [params={}] - Parameters for checking the primary key.
|
|
1413
|
+
* @param {string} [params.table] - The table to check. Defaults to the current model table.
|
|
1414
|
+
*
|
|
1415
|
+
* @returns {Promise<boolean>} Returns `true` if the table has a primary key constraint,
|
|
1416
|
+
* otherwise `false`.
|
|
1417
|
+
*/
|
|
1418
|
+
hasPrimaryKey({ table }?: {
|
|
1213
1419
|
table?: string;
|
|
1214
1420
|
}): Promise<boolean>;
|
|
1421
|
+
/**
|
|
1422
|
+
* Adds a primary key constraint to a table.
|
|
1423
|
+
*
|
|
1424
|
+
* This method checks whether the table already has a primary key
|
|
1425
|
+
* before attempting to create one. If a primary key already exists,
|
|
1426
|
+
* an error will be thrown.
|
|
1427
|
+
*
|
|
1428
|
+
* @async
|
|
1429
|
+
* @method addPrimaryKey
|
|
1430
|
+
* @param {Object} params - Parameters for creating the primary key.
|
|
1431
|
+
* @param {string} [params.table] - The table where the primary key will be added. Defaults to the current model table.
|
|
1432
|
+
* @param {string[]} params.columns - The column(s) that will form the primary key.
|
|
1433
|
+
*
|
|
1434
|
+
* @throws {Error} If the table already has a primary key constraint.
|
|
1435
|
+
*
|
|
1436
|
+
* @returns {Promise<void>} Resolves when the primary key has been successfully created.
|
|
1437
|
+
*/
|
|
1438
|
+
addPrimaryKey({ table, columns }: {
|
|
1439
|
+
table?: string;
|
|
1440
|
+
columns: string[];
|
|
1441
|
+
}): Promise<void>;
|
|
1442
|
+
/**
|
|
1443
|
+
* Drops the primary key constraint from a table.
|
|
1444
|
+
*
|
|
1445
|
+
* This method checks whether the table has a primary key before
|
|
1446
|
+
* attempting to remove it. If no primary key exists, an error will be thrown.
|
|
1447
|
+
*
|
|
1448
|
+
* @async
|
|
1449
|
+
* @method dropPrimaryKey
|
|
1450
|
+
* @param {Object} [params={}] - Parameters for dropping the primary key.
|
|
1451
|
+
* @param {string} [params.table] - The table from which the primary key will be removed. Defaults to the current model table.
|
|
1452
|
+
*
|
|
1453
|
+
* @throws {Error} If the specified primary key constraint was not found.
|
|
1454
|
+
*
|
|
1455
|
+
* @returns {Promise<void>} Resolves when the primary key constraint has been successfully removed.
|
|
1456
|
+
*/
|
|
1457
|
+
dropPrimaryKey({ table }?: {
|
|
1458
|
+
table?: string;
|
|
1459
|
+
}): Promise<void>;
|
|
1215
1460
|
/**
|
|
1216
1461
|
* The 'bindColumn' method is used to concat table and column -> `users`.`id`
|
|
1217
1462
|
* @param {string} column
|
|
@@ -1330,10 +1575,10 @@ declare class Builder extends AbstractBuilder {
|
|
|
1330
1575
|
* The 'find' method is used to retrieve a single record from a database table by its primary key.
|
|
1331
1576
|
*
|
|
1332
1577
|
* This method allows you to quickly fetch a specific record by specifying the primary key value, which is typically an integer id.
|
|
1333
|
-
* @param {number}
|
|
1578
|
+
* @param {number | string} primaryKey
|
|
1334
1579
|
* @returns {promise<any>}
|
|
1335
1580
|
*/
|
|
1336
|
-
find(
|
|
1581
|
+
find(primaryKey: number | string): Promise<Record<string, any> | null>;
|
|
1337
1582
|
/**
|
|
1338
1583
|
* The 'pagination' method is used to perform pagination on a set of database query results obtained through the Query Builder.
|
|
1339
1584
|
*
|
|
@@ -1586,6 +1831,15 @@ declare class Builder extends AbstractBuilder {
|
|
|
1586
1831
|
* @async
|
|
1587
1832
|
*/
|
|
1588
1833
|
getTables(): Promise<string[]>;
|
|
1834
|
+
/**
|
|
1835
|
+
* The `getTable` method is used to retrieve a list of all table names
|
|
1836
|
+
* in the current database.
|
|
1837
|
+
*
|
|
1838
|
+
* @returns {Promise<string[]>} A promise that resolves to an array of table names.
|
|
1839
|
+
*
|
|
1840
|
+
* @async
|
|
1841
|
+
*/
|
|
1842
|
+
hasTable(table: string): Promise<boolean>;
|
|
1589
1843
|
/**
|
|
1590
1844
|
*
|
|
1591
1845
|
* The 'showColumns' method is used to show columns table.
|