@typetron/framework 0.3.16 → 0.3.18
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/Cache/Cache.d.ts +9 -0
- package/Cache/Cache.d.ts.map +1 -0
- package/Cache/Cache.js +7 -0
- package/Cache/Cache.js.map +1 -0
- package/Cache/CacheLoader.d.ts +8 -0
- package/Cache/CacheLoader.d.ts.map +1 -0
- package/Cache/CacheLoader.js +55 -0
- package/Cache/CacheLoader.js.map +1 -0
- package/Cache/Consumers/Cache.d.ts +18 -0
- package/Cache/Consumers/Cache.d.ts.map +1 -0
- package/Cache/Consumers/Cache.js +99 -0
- package/Cache/Consumers/Cache.js.map +1 -0
- package/Cache/Contracts/CacheInterface.d.ts +14 -0
- package/Cache/Contracts/CacheInterface.d.ts.map +1 -0
- package/Cache/Contracts/CacheInterface.js +3 -0
- package/Cache/Contracts/CacheInterface.js.map +1 -0
- package/Cache/Contracts/EngineInterface.d.ts +8 -0
- package/Cache/Contracts/EngineInterface.d.ts.map +1 -0
- package/Cache/Contracts/EngineInterface.js +3 -0
- package/Cache/Contracts/EngineInterface.js.map +1 -0
- package/Cache/Contracts/ServiceInterface.d.ts +8 -0
- package/Cache/Contracts/ServiceInterface.d.ts.map +1 -0
- package/Cache/Contracts/ServiceInterface.js +3 -0
- package/Cache/Contracts/ServiceInterface.js.map +1 -0
- package/Cache/Engines/DatabaseCache.d.ts +11 -0
- package/Cache/Engines/DatabaseCache.d.ts.map +1 -0
- package/Cache/Engines/DatabaseCache.js +40 -0
- package/Cache/Engines/DatabaseCache.js.map +1 -0
- package/Cache/Engines/FileCache.d.ts +22 -0
- package/Cache/Engines/FileCache.d.ts.map +1 -0
- package/Cache/Engines/FileCache.js +107 -0
- package/Cache/Engines/FileCache.js.map +1 -0
- package/Cache/Services/DatabaseCacheService.d.ts +13 -0
- package/Cache/Services/DatabaseCacheService.d.ts.map +1 -0
- package/Cache/Services/DatabaseCacheService.js +74 -0
- package/Cache/Services/DatabaseCacheService.js.map +1 -0
- package/Cache/Services/FileCacheService.d.ts +13 -0
- package/Cache/Services/FileCacheService.d.ts.map +1 -0
- package/Cache/Services/FileCacheService.js +60 -0
- package/Cache/Services/FileCacheService.js.map +1 -0
- package/Cache/Stores/DatabaseStore.d.ts +16 -0
- package/Cache/Stores/DatabaseStore.d.ts.map +1 -0
- package/Cache/Stores/DatabaseStore.js +208 -0
- package/Cache/Stores/DatabaseStore.js.map +1 -0
- package/Cache/Stores/FileStore.d.ts +16 -0
- package/Cache/Stores/FileStore.d.ts.map +1 -0
- package/Cache/Stores/FileStore.js +63 -0
- package/Cache/Stores/FileStore.js.map +1 -0
- package/Cache/Stores/MemoryStore.d.ts +13 -0
- package/Cache/Stores/MemoryStore.d.ts.map +1 -0
- package/Cache/Stores/MemoryStore.js +60 -0
- package/Cache/Stores/MemoryStore.js.map +1 -0
- package/Cache/index.d.ts +6 -0
- package/Cache/index.d.ts.map +1 -0
- package/Cache/index.js +18 -0
- package/Cache/index.js.map +1 -0
- package/Cache/types.d.ts +5 -0
- package/Cache/types.d.ts.map +1 -0
- package/Cache/types.js +3 -0
- package/Cache/types.js.map +1 -0
- package/Container/ClassResolver.d.ts +8 -8
- package/Container/ClassResolver.d.ts.map +1 -1
- package/Container/ClassResolver.js +89 -87
- package/Container/ClassResolver.js.map +1 -1
- package/Container/Container.d.ts +24 -24
- package/Container/Container.d.ts.map +1 -1
- package/Container/Container.js +118 -118
- package/Container/Container.js.map +1 -1
- package/Container/Contracts.d.ts +2 -2
- package/Container/Contracts.js +2 -2
- package/Container/Decorators.d.ts +4 -4
- package/Container/Decorators.js +21 -21
- package/Container/Metadata.d.ts +20 -20
- package/Container/Metadata.js +18 -18
- package/Container/Resolver.d.ts +18 -18
- package/Container/Resolver.js +15 -15
- package/Container/index.d.ts +5 -5
- package/Container/index.js +17 -17
- package/Database/Clauses/Where.js +1 -1
- package/Database/Connection.d.ts +20 -20
- package/Database/Connection.js +42 -42
- package/Database/Decorators.d.ts +36 -36
- package/Database/Decorators.js +116 -116
- package/Database/Drivers/DatabaseDriver.d.ts +28 -28
- package/Database/Drivers/DatabaseDriver.js +6 -6
- package/Database/Drivers/MySQL/Alter/index.d.ts +33 -33
- package/Database/Drivers/MySQL/Alter/index.js +61 -61
- package/Database/Drivers/MySQL/ColumnDefinition.d.ts +6 -6
- package/Database/Drivers/MySQL/ColumnDefinition.js +17 -17
- package/Database/Drivers/MySQL/Create.d.ts +9 -9
- package/Database/Drivers/MySQL/Create.js +37 -37
- package/Database/Drivers/MySQL/MysqlDriver.d.ts +41 -41
- package/Database/Drivers/MySQL/MysqlDriver.js +76 -76
- package/Database/Drivers/MySQL/Schema.d.ts +15 -15
- package/Database/Drivers/MySQL/Schema.js +65 -65
- package/Database/Drivers/MySQL/index.d.ts +1 -1
- package/Database/Drivers/MySQL/index.js +15 -15
- package/Database/Drivers/SQL/Schema.d.ts +6 -6
- package/Database/Drivers/SQL/Schema.js +57 -57
- package/Database/Drivers/SQL/Statements/Alter.d.ts +7 -7
- package/Database/Drivers/SQL/Statements/Alter.js +17 -17
- package/Database/Drivers/SQL/Statements/BaseStatement.d.ts +12 -12
- package/Database/Drivers/SQL/Statements/BaseStatement.js +46 -46
- package/Database/Drivers/SQL/Statements/Delete.d.ts +5 -5
- package/Database/Drivers/SQL/Statements/Delete.js +16 -16
- package/Database/Drivers/SQL/Statements/Insert.d.ts +6 -6
- package/Database/Drivers/SQL/Statements/Insert.js +23 -23
- package/Database/Drivers/SQL/Statements/Select.d.ts +7 -7
- package/Database/Drivers/SQL/Statements/Select.js +44 -44
- package/Database/Drivers/SQL/Statements/Update.d.ts +6 -6
- package/Database/Drivers/SQL/Statements/Update.js +27 -27
- package/Database/Drivers/SQL/index.d.ts +8 -8
- package/Database/Drivers/SQL/index.js +2 -2
- package/Database/Drivers/SQLite/Create.d.ts +9 -9
- package/Database/Drivers/SQLite/Create.js +36 -36
- package/Database/Drivers/SQLite/Schema.d.ts +15 -15
- package/Database/Drivers/SQLite/Schema.js +44 -44
- package/Database/Drivers/SQLite/SqliteDriver.d.ts +42 -42
- package/Database/Drivers/SQLite/SqliteDriver.d.ts.map +1 -1
- package/Database/Drivers/SQLite/SqliteDriver.js +102 -102
- package/Database/Drivers/SQLite/SqliteDriver.js.map +1 -1
- package/Database/Drivers/SQLite/index.d.ts +2 -2
- package/Database/Drivers/SQLite/index.js +26 -26
- package/Database/Drivers/SchemaContract.d.ts +8 -8
- package/Database/Drivers/SchemaContract.js +9 -9
- package/Database/Drivers/Statement.d.ts +9 -9
- package/Database/Drivers/Statement.js +15 -15
- package/Database/Drivers/index.d.ts +4 -4
- package/Database/Drivers/index.js +16 -16
- package/Database/Entity.d.ts +64 -64
- package/Database/Entity.d.ts.map +1 -1
- package/Database/Entity.js +252 -252
- package/Database/Entity.js.map +1 -1
- package/Database/EntityNotFoundError.d.ts +5 -5
- package/Database/EntityNotFoundError.js +10 -10
- package/Database/EntityProxyHandler.d.ts +5 -5
- package/Database/EntityProxyHandler.js +30 -30
- package/Database/EntityQuery.d.ts +28 -28
- package/Database/EntityQuery.js +156 -156
- package/Database/Expression.d.ts +3 -3
- package/Database/Expression.js +6 -6
- package/Database/Fields.d.ts +155 -155
- package/Database/Fields.js +548 -548
- package/Database/Helpers.d.ts +1 -1
- package/Database/Helpers.js +16 -16
- package/Database/List.d.ts +24 -24
- package/Database/List.d.ts.map +1 -1
- package/Database/List.js +49 -49
- package/Database/List.js.map +1 -1
- package/Database/Migrations/Migration.d.ts +7 -7
- package/Database/Migrations/Migration.js +9 -9
- package/Database/Migrations/MigrationHistory.d.ts +8 -8
- package/Database/Migrations/MigrationHistory.js +38 -38
- package/Database/Migrations/Migrator.d.ts +20 -20
- package/Database/Migrations/Migrator.js +118 -118
- package/Database/Migrations/index.d.ts +3 -3
- package/Database/Migrations/index.js +15 -15
- package/Database/ORM/BaseRelationship.d.ts +7 -7
- package/Database/ORM/BaseRelationship.js +10 -10
- package/Database/Query.d.ts +62 -62
- package/Database/Query.d.ts.map +1 -1
- package/Database/Query.js +265 -264
- package/Database/Query.js.map +1 -1
- package/Database/Seeders/Seeder.d.ts +3 -3
- package/Database/Seeders/Seeder.js +6 -6
- package/Database/Seeders/SeederManager.d.ts +8 -8
- package/Database/Seeders/SeederManager.js +24 -24
- package/Database/Seeders/index.d.ts +2 -2
- package/Database/Seeders/index.js +14 -14
- package/Database/StringExpression.d.ts +6 -6
- package/Database/StringExpression.js +14 -14
- package/Database/Types.d.ts +117 -117
- package/Database/Types.d.ts.map +1 -1
- package/Database/Types.js +94 -94
- package/Database/Types.js.map +1 -1
- package/Database/index.d.ts +20 -20
- package/Database/index.js +20 -20
- package/Encryption/index.d.ts +15 -15
- package/Encryption/index.js +53 -53
- package/Forms/Decorators.d.ts +6 -6
- package/Forms/Decorators.js +28 -28
- package/Forms/Form.d.ts +17 -17
- package/Forms/Form.js +69 -69
- package/Forms/FormFields.d.ts +9 -9
- package/Forms/FormFields.js +35 -35
- package/Forms/index.d.ts +3 -3
- package/Forms/index.js +15 -15
- package/Framework/App.d.ts +6 -6
- package/Framework/App.js +9 -9
- package/Framework/Application.d.ts +17 -17
- package/Framework/Application.d.ts.map +1 -1
- package/Framework/Application.js +94 -93
- package/Framework/Application.js.map +1 -1
- package/Framework/Auth/Auth.d.ts +24 -24
- package/Framework/Auth/Auth.js +108 -108
- package/Framework/Auth/Authenticatable.d.ts +6 -6
- package/Framework/Auth/Authenticatable.js +2 -2
- package/Framework/Auth/User.d.ts +10 -10
- package/Framework/Auth/User.js +37 -37
- package/Framework/Auth/index.d.ts +5 -5
- package/Framework/Auth/index.d.ts.map +1 -1
- package/Framework/Auth/index.js +45 -45
- package/Framework/Auth/index.js.map +1 -1
- package/Framework/Config/AppConfig.d.ts +18 -18
- package/Framework/Config/AppConfig.js +11 -11
- package/Framework/Config/AuthConfig.d.ts +8 -8
- package/Framework/Config/AuthConfig.js +7 -7
- package/Framework/Config/BaseConfig.d.ts +6 -6
- package/Framework/Config/BaseConfig.js +12 -12
- package/Framework/Config/CacheConfig.d.ts +16 -0
- package/Framework/Config/CacheConfig.d.ts.map +1 -0
- package/Framework/Config/CacheConfig.js +23 -0
- package/Framework/Config/CacheConfig.js.map +1 -0
- package/Framework/Config/DatabaseConfig.d.ts +10 -10
- package/Framework/Config/DatabaseConfig.js +25 -25
- package/Framework/Config/index.d.ts +5 -4
- package/Framework/Config/index.d.ts.map +1 -1
- package/Framework/Config/index.js +17 -16
- package/Framework/Config/index.js.map +1 -1
- package/Framework/Middleware/AuthMiddleware.d.ts +7 -7
- package/Framework/Middleware/AuthMiddleware.js +63 -63
- package/Framework/Middleware/CorsMiddleware.d.ts +6 -6
- package/Framework/Middleware/CorsMiddleware.js +43 -43
- package/Framework/Middleware/StaticAssetsMiddleware.d.ts +14 -14
- package/Framework/Middleware/StaticAssetsMiddleware.js +104 -104
- package/Framework/Middleware/index.d.ts +2 -2
- package/Framework/Middleware/index.js +14 -14
- package/Framework/Provider.d.ts +5 -5
- package/Framework/Provider.js +20 -20
- package/Framework/Providers/CacheProvider.d.ts +7 -0
- package/Framework/Providers/CacheProvider.d.ts.map +1 -0
- package/Framework/Providers/CacheProvider.js +39 -0
- package/Framework/Providers/CacheProvider.js.map +1 -0
- package/Framework/Providers/DatabaseProvider.d.ts +9 -9
- package/Framework/Providers/DatabaseProvider.js +63 -63
- package/Framework/Providers/WebsocketsProvider.d.ts +12 -12
- package/Framework/Providers/WebsocketsProvider.js +122 -122
- package/Framework/Resolvers/AuthResolver.d.ts +5 -5
- package/Framework/Resolvers/AuthResolver.js +14 -14
- package/Framework/Resolvers/EntityResolver.d.ts +9 -9
- package/Framework/Resolvers/EntityResolver.js +40 -40
- package/Framework/Resolvers/FormResolver.d.ts +9 -9
- package/Framework/Resolvers/FormResolver.js +32 -32
- package/Framework/RootDir.d.ts +2 -2
- package/Framework/RootDir.js +6 -6
- package/Framework/index.d.ts +7 -6
- package/Framework/index.d.ts.map +1 -1
- package/Framework/index.js +19 -18
- package/Framework/index.js.map +1 -1
- package/Models/Model.d.ts +9 -9
- package/Models/Model.js +35 -35
- package/Models/index.d.ts +21 -21
- package/Models/index.d.ts.map +1 -1
- package/Models/index.js +58 -58
- package/Models/index.js.map +1 -1
- package/Router/BaseController.d.ts +4 -4
- package/Router/BaseController.js +20 -20
- package/Router/Decorators.d.ts +21 -21
- package/Router/Decorators.js +170 -170
- package/Router/Guard.d.ts +4 -4
- package/Router/Guard.js +10 -10
- package/Router/Http/Contracts.d.ts +3 -3
- package/Router/Http/Contracts.js +2 -2
- package/Router/Http/ErrorHandler.d.ts +9 -9
- package/Router/Http/ErrorHandler.js +51 -51
- package/Router/Http/ErrorHandlerInterface.d.ts +5 -5
- package/Router/Http/ErrorHandlerInterface.js +6 -6
- package/Router/Http/Errors/HttpError.d.ts +7 -7
- package/Router/Http/Errors/HttpError.js +15 -15
- package/Router/Http/Handler.d.ts +15 -15
- package/Router/Http/Handler.js +131 -131
- package/Router/Http/Request.d.ts +22 -22
- package/Router/Http/Request.js +151 -151
- package/Router/Http/Response.d.ts +17 -17
- package/Router/Http/Response.js +51 -51
- package/Router/Http/index.d.ts +83 -83
- package/Router/Http/index.js +99 -99
- package/Router/Metadata.d.ts +31 -31
- package/Router/Metadata.js +25 -25
- package/Router/Middleware.d.ts +5 -5
- package/Router/Middleware.js +2 -2
- package/Router/Route.d.ts +23 -23
- package/Router/Route.js +110 -110
- package/Router/RouteNotFoundError.d.ts +3 -3
- package/Router/RouteNotFoundError.js +9 -9
- package/Router/Router.d.ts +12 -12
- package/Router/Router.js +32 -32
- package/Router/Websockets/Handler.d.ts +12 -12
- package/Router/Websockets/Handler.js +59 -59
- package/Router/Websockets/WebsocketEvent.d.ts +15 -15
- package/Router/Websockets/WebsocketEvent.js +53 -53
- package/Router/Websockets/index.d.ts +16 -16
- package/Router/Websockets/index.d.ts.map +1 -1
- package/Router/Websockets/index.js +57 -57
- package/Router/Websockets/index.js.map +1 -1
- package/Router/Websockets/types.d.ts +20 -20
- package/Router/Websockets/types.js +8 -8
- package/Router/index.d.ts +6 -6
- package/Router/index.js +18 -18
- package/Storage/File.d.ts +11 -11
- package/Storage/File.js +46 -46
- package/Storage/Image.d.ts +3 -3
- package/Storage/Image.js +7 -7
- package/Storage/InvalidImage.d.ts +3 -3
- package/Storage/InvalidImage.js +7 -7
- package/Storage/Storage.d.ts +13 -12
- package/Storage/Storage.d.ts.map +1 -1
- package/Storage/Storage.js +104 -110
- package/Storage/Storage.js.map +1 -1
- package/Storage/index.d.ts +4 -4
- package/Storage/index.js +16 -16
- package/Storage/utils.d.ts +5 -5
- package/Storage/utils.js +20 -20
- package/Support/Array.d.ts +28 -28
- package/Support/Array.d.ts.map +1 -1
- package/Support/Array.js +108 -108
- package/Support/Array.js.map +1 -1
- package/Support/Math.d.ts +6 -6
- package/Support/Math.js +7 -7
- package/Support/Metadata.d.ts +14 -14
- package/Support/Metadata.js +20 -20
- package/Support/String.d.ts +11 -11
- package/Support/String.js +23 -23
- package/Support/index.d.ts +14 -13
- package/Support/index.d.ts.map +1 -1
- package/Support/index.js +6 -5
- package/Support/index.js.map +1 -1
- package/Support/utils.d.ts +2 -0
- package/Support/utils.d.ts.map +1 -0
- package/Support/utils.js +13 -0
- package/Support/utils.js.map +1 -0
- package/Testing/TestCase.d.ts +32 -32
- package/Testing/TestCase.js +130 -130
- package/Validation/Rule.d.ts +6 -6
- package/Validation/Rule.js +6 -6
- package/Validation/RuleInterface.d.ts +6 -6
- package/Validation/RuleInterface.js +2 -2
- package/Validation/Rules/Email.d.ts +3 -3
- package/Validation/Rules/Email.js +20 -20
- package/Validation/Rules/FileExtension.d.ts +3 -3
- package/Validation/Rules/FileExtension.js +22 -22
- package/Validation/Rules/MaxLength.d.ts +3 -3
- package/Validation/Rules/MaxLength.js +19 -19
- package/Validation/Rules/MinLength.d.ts +3 -3
- package/Validation/Rules/MinLength.js +19 -19
- package/Validation/Rules/Optional.d.ts +3 -3
- package/Validation/Rules/Optional.js +19 -19
- package/Validation/Rules/Required.d.ts +3 -3
- package/Validation/Rules/Required.js +26 -26
- package/Validation/Validator.d.ts +11 -11
- package/Validation/Validator.js +10 -10
- package/Validation/index.d.ts +9 -9
- package/Validation/index.js +21 -21
- package/package.json +8 -5
- package/tests/Cache/DatabaseStoreTest.d.ts +2 -0
- package/tests/Cache/DatabaseStoreTest.d.ts.map +1 -0
- package/tests/Cache/DatabaseStoreTest.js +138 -0
- package/tests/Cache/DatabaseStoreTest.js.map +1 -0
- package/tests/Cache/FileStoreTest.d.ts +2 -0
- package/tests/Cache/FileStoreTest.d.ts.map +1 -0
- package/tests/Cache/FileStoreTest.js +142 -0
- package/tests/Cache/FileStoreTest.js.map +1 -0
- package/tests/Cache/MemoryStoreTest.d.ts +2 -0
- package/tests/Cache/MemoryStoreTest.d.ts.map +1 -0
- package/tests/Cache/MemoryStoreTest.js +141 -0
- package/tests/Cache/MemoryStoreTest.js.map +1 -0
- package/tests/Container/ContainerTest.d.ts +1 -1
- package/tests/Container/ContainerTest.js +395 -395
- package/tests/Database/Drivers/MySQL/AlterTest.d.ts +1 -1
- package/tests/Database/Drivers/MySQL/AlterTest.js +135 -135
- package/tests/Database/Drivers/MySQL/CreateTest.d.ts +1 -1
- package/tests/Database/Drivers/MySQL/CreateTest.js +57 -57
- package/tests/Database/Drivers/MysqlDriverTest.d.ts +1 -1
- package/tests/Database/Drivers/MysqlDriverTest.js +149 -149
- package/tests/Database/Drivers/SqliteDriverTest.d.ts +1 -1
- package/tests/Database/Drivers/SqliteDriverTest.js +135 -135
- package/tests/Database/Entities/Article.d.ts +10 -10
- package/tests/Database/Entities/Article.js +42 -42
- package/tests/Database/Entities/Profile.d.ts +10 -10
- package/tests/Database/Entities/Profile.js +38 -38
- package/tests/Database/Entities/Role.d.ts +8 -8
- package/tests/Database/Entities/Role.js +30 -30
- package/tests/Database/Entities/User.d.ts +15 -15
- package/tests/Database/Entities/User.js +57 -57
- package/tests/Database/EntityRelationshipsTest.d.ts +1 -1
- package/tests/Database/EntityRelationshipsTest.js +552 -552
- package/tests/Database/EntityTest.d.ts +1 -1
- package/tests/Database/EntityTest.js +233 -233
- package/tests/Database/Migrations/RunnerTest.d.ts +1 -1
- package/tests/Database/Migrations/RunnerTest.js +111 -111
- package/tests/Database/Migrations/migrations/1.createUserTable.d.ts +5 -5
- package/tests/Database/Migrations/migrations/1.createUserTable.js +13 -13
- package/tests/Database/Migrations/migrations/2.createArticlesTable.d.ts +5 -5
- package/tests/Database/Migrations/migrations/2.createArticlesTable.js +13 -13
- package/tests/Database/QueryTest.d.ts +1 -1
- package/tests/Database/QueryTest.js +622 -622
- package/tests/Database/SchemaTest.d.ts +1 -1
- package/tests/Database/SchemaTest.js +45 -45
- package/tests/Database/Seeders/RunnerTest.d.ts +1 -1
- package/tests/Database/Seeders/RunnerTest.js +43 -43
- package/tests/Database/Seeders/seeders/RandomSeeder.d.ts +4 -4
- package/tests/Database/Seeders/seeders/RandomSeeder.js +13 -13
- package/tests/Database/utils.d.ts +5 -5
- package/tests/Database/utils.js +18 -18
- package/tests/Forms/FormsTest.d.ts +1 -1
- package/tests/Forms/FormsTest.js +79 -79
- package/tests/Framework/Middleware/StaticAssetsMiddlewareTest.d.ts +1 -1
- package/tests/Framework/Middleware/StaticAssetsMiddlewareTest.js +165 -165
- package/tests/Framework/Resolvers/EntityResolverTest.d.ts +1 -1
- package/tests/Framework/Resolvers/EntityResolverTest.js +59 -59
- package/tests/Model/ModelTest.d.ts +1 -1
- package/tests/Model/ModelTest.js +233 -233
- package/tests/Router/HttpHandlerTest.d.ts +1 -1
- package/tests/Router/HttpHandlerTest.js +36 -36
- package/tests/Router/WebSocketsHandlerTest.d.ts +1 -1
- package/tests/Router/WebSocketsHandlerTest.js +35 -35
- package/tests/Support/ArrayTest.d.ts +1 -1
- package/tests/Support/ArrayTest.js +258 -258
- package/tests/Support/StringTest.d.ts +1 -1
- package/tests/Support/StringTest.js +38 -38
- package/tests/Validation/RulesTest.d.ts +1 -1
- package/tests/Validation/RulesTest.js +67 -67
- package/Database/Drivers/SQL/Statements/Create.d.ts +0 -7
- package/Database/Drivers/SQL/Statements/Create.d.ts.map +0 -1
- package/Database/Drivers/SQL/Statements/Create.js +0 -22
- package/Database/Drivers/SQL/Statements/Create.js.map +0 -1
- package/LICENSE.md +0 -21
- package/Readme.md +0 -123
|
@@ -1,623 +1,623 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const chai_1 = require("chai");
|
|
13
|
-
const mocha_1 = require("@testdeck/mocha");
|
|
14
|
-
const Database_1 = require("../../Database");
|
|
15
|
-
const ts_mockito_1 = require("ts-mockito");
|
|
16
|
-
const Drivers_1 = require("@Typetron/Database/Drivers");
|
|
17
|
-
const utils_1 = require("@Typetron/tests/Database/utils");
|
|
18
|
-
let QueryTest = class QueryTest {
|
|
19
|
-
before() {
|
|
20
|
-
this.connection = ts_mockito_1.mock(Database_1.Connection);
|
|
21
|
-
Database_1.Query.connection = ts_mockito_1.instance(this.connection);
|
|
22
|
-
Database_1.Query.connection.driver = new Drivers_1.SqliteDriver(':memory:');
|
|
23
|
-
ts_mockito_1.when(this.connection.get(ts_mockito_1.anyOfClass(Database_1.Query))).thenCall((query) => {
|
|
24
|
-
return query.toSQL();
|
|
25
|
-
});
|
|
26
|
-
this.query = new Database_1.Query();
|
|
27
|
-
}
|
|
28
|
-
async expect() {
|
|
29
|
-
return chai_1.expect(utils_1.trimSQL(await this.query.toSQL()));
|
|
30
|
-
}
|
|
31
|
-
expectBindings() {
|
|
32
|
-
return chai_1.expect(this.query.getBindings());
|
|
33
|
-
}
|
|
34
|
-
async selectsEverything() {
|
|
35
|
-
utils_1.expectQuery(Database_1.Query.table('users')).toEqual('SELECT * FROM users');
|
|
36
|
-
}
|
|
37
|
-
async selectSpecificColumns() {
|
|
38
|
-
utils_1.expectQuery(Database_1.Query.table('users').select('name', 'email')).toEqual('SELECT name, email FROM users');
|
|
39
|
-
}
|
|
40
|
-
async addColumns() {
|
|
41
|
-
utils_1.expectQuery(Database_1.Query.table('users').addSelect('name', 'email')).toEqual('SELECT name, email FROM users');
|
|
42
|
-
}
|
|
43
|
-
async selectDistinct() {
|
|
44
|
-
utils_1.expectQuery(Database_1.Query.table('users').distinct().select('name', 'email')).toEqual('SELECT DISTINCT name, email FROM users');
|
|
45
|
-
}
|
|
46
|
-
async first() {
|
|
47
|
-
ts_mockito_1.when(this.connection.first(ts_mockito_1.anyOfClass(Database_1.Query))).thenResolve({ name: 'John' });
|
|
48
|
-
const user = await this.query.table('users').first('name');
|
|
49
|
-
(await this.expect()).to.equal('SELECT name FROM users');
|
|
50
|
-
chai_1.expect(user).to.deep.equal({ name: 'John' });
|
|
51
|
-
}
|
|
52
|
-
async where() {
|
|
53
|
-
const query = Database_1.Query.table('users').where('name', '=', 'John');
|
|
54
|
-
utils_1.expectQuery(query).toEqual('SELECT * FROM users WHERE name = ?');
|
|
55
|
-
chai_1.expect(query.getBindings()).to.deep.equal(['John']);
|
|
56
|
-
}
|
|
57
|
-
async whereWithDefaultOperator() {
|
|
58
|
-
const query = Database_1.Query.table('users').where('name', 'John');
|
|
59
|
-
utils_1.expectQuery(query).toEqual('SELECT * FROM users WHERE name = ?');
|
|
60
|
-
chai_1.expect(query.getBindings()).to.deep.equal(['John']);
|
|
61
|
-
}
|
|
62
|
-
// @test
|
|
63
|
-
// async whereWithObject() {
|
|
64
|
-
// Query.table('users').where({name: 'John', age: 21});
|
|
65
|
-
//
|
|
66
|
-
// (await this.expectSql()).to.equal('SELECT * FROM users WHERE name = ? AND age = ?');
|
|
67
|
-
// this.expectBindings().to.deep.equal(['John', 21]);
|
|
68
|
-
// }
|
|
69
|
-
// @test
|
|
70
|
-
// async whereWithArray() {
|
|
71
|
-
// Query.table('users').where([
|
|
72
|
-
// ['name', '=', 'John'],
|
|
73
|
-
// ['age', '=', 21]
|
|
74
|
-
// ]);
|
|
75
|
-
//
|
|
76
|
-
// (await this.expectSql()).to.equal('SELECT * FROM users WHERE name = ? AND age = ?');
|
|
77
|
-
// this.expectBindings().to.deep.equal(['John', 21]);
|
|
78
|
-
// }
|
|
79
|
-
async whereOrOperator() {
|
|
80
|
-
this.query.table('users').where('name', 'John').orWhere('age', 21);
|
|
81
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age = ?');
|
|
82
|
-
this.expectBindings().to.deep.equal(['John', 21]);
|
|
83
|
-
}
|
|
84
|
-
async whereBetween() {
|
|
85
|
-
this.query.table('users').whereBetween('age', [18, 25]);
|
|
86
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age BETWEEN ? AND ?');
|
|
87
|
-
this.expectBindings().to.deep.equal([18, 25]);
|
|
88
|
-
}
|
|
89
|
-
async whereNotBetween() {
|
|
90
|
-
this.query.table('users').whereNotBetween('age', [18, 25]);
|
|
91
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age NOT BETWEEN ? AND ?');
|
|
92
|
-
this.expectBindings().to.deep.equal([18, 25]);
|
|
93
|
-
}
|
|
94
|
-
async orWhereBetween() {
|
|
95
|
-
this.query.table('users').where('name', 'John').orWhereBetween('age', [18, 25]);
|
|
96
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age BETWEEN ? AND ?');
|
|
97
|
-
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
98
|
-
}
|
|
99
|
-
async orWhereNotBetween() {
|
|
100
|
-
this.query.table('users').where('name', 'John').orWhereNotBetween('age', [18, 25]);
|
|
101
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age NOT BETWEEN ? AND ?');
|
|
102
|
-
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
103
|
-
}
|
|
104
|
-
async whereIn() {
|
|
105
|
-
this.query.table('users').whereIn('age', [18, 25]);
|
|
106
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age IN (?, ?)');
|
|
107
|
-
this.expectBindings().to.deep.equal([18, 25]);
|
|
108
|
-
}
|
|
109
|
-
async whereNotIn() {
|
|
110
|
-
this.query.table('users').whereNotIn('age', [18, 25]);
|
|
111
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age NOT IN (?, ?)');
|
|
112
|
-
this.expectBindings().to.deep.equal([18, 25]);
|
|
113
|
-
}
|
|
114
|
-
async orWhereIn() {
|
|
115
|
-
this.query.table('users').where('name', 'John').orWhereIn('age', [18, 25]);
|
|
116
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age IN (?, ?)');
|
|
117
|
-
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
118
|
-
}
|
|
119
|
-
async orWhereNotIn() {
|
|
120
|
-
this.query.table('users').where('name', 'John').orWhereNotIn('age', [18, 25]);
|
|
121
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age NOT IN (?, ?)');
|
|
122
|
-
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
123
|
-
}
|
|
124
|
-
async whereNull() {
|
|
125
|
-
this.query.table('users').whereNull('age');
|
|
126
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NULL');
|
|
127
|
-
this.expectBindings().to.deep.equal([]);
|
|
128
|
-
}
|
|
129
|
-
async andWhereNull() {
|
|
130
|
-
this.query.table('users').andWhereNull('age');
|
|
131
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NULL');
|
|
132
|
-
this.expectBindings().to.deep.equal([]);
|
|
133
|
-
}
|
|
134
|
-
async whereNotNull() {
|
|
135
|
-
this.query.table('users').whereNotNull('age');
|
|
136
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NOT NULL');
|
|
137
|
-
this.expectBindings().to.deep.equal([]);
|
|
138
|
-
}
|
|
139
|
-
async andWhereNotNull() {
|
|
140
|
-
this.query.table('users').andWhereNotNull('age');
|
|
141
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NOT NULL');
|
|
142
|
-
this.expectBindings().to.deep.equal([]);
|
|
143
|
-
}
|
|
144
|
-
async orWhereNull() {
|
|
145
|
-
this.query.table('users').where('name', 'John').orWhereNull('age');
|
|
146
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age IS NULL');
|
|
147
|
-
this.expectBindings().to.deep.equal(['John']);
|
|
148
|
-
}
|
|
149
|
-
async orWhereNotNull() {
|
|
150
|
-
this.query.table('users').where('name', 'John').orWhereNotNull('age');
|
|
151
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age IS NOT NULL');
|
|
152
|
-
this.expectBindings().to.deep.equal(['John']);
|
|
153
|
-
}
|
|
154
|
-
async orWhereLike() {
|
|
155
|
-
this.query.table('users').where('age', 18).orWhereLike('name', '%John');
|
|
156
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? OR name LIKE ?');
|
|
157
|
-
this.expectBindings().to.deep.equal([18, '%John']);
|
|
158
|
-
}
|
|
159
|
-
async orWhereNotLike() {
|
|
160
|
-
this.query.table('users').where('age', 18).orWhereNotLike('name', '%John');
|
|
161
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? OR name NOT LIKE ?');
|
|
162
|
-
this.expectBindings().to.deep.equal([18, '%John']);
|
|
163
|
-
}
|
|
164
|
-
async andWhereIn() {
|
|
165
|
-
this.query.table('users').where('age', 18).andWhereIn('name', ['John', 'Doe']);
|
|
166
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? AND name IN (?, ?)');
|
|
167
|
-
this.expectBindings().to.deep.equal([18, 'John', 'Doe']);
|
|
168
|
-
}
|
|
169
|
-
async andWhereNotIn() {
|
|
170
|
-
this.query.table('users').where('age', 18).andWhereNotIn('name', ['John', 'Doe']);
|
|
171
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? AND name NOT IN (?, ?)');
|
|
172
|
-
this.expectBindings().to.deep.equal([18, 'John', 'Doe']);
|
|
173
|
-
}
|
|
174
|
-
async whereLike() {
|
|
175
|
-
this.query.table('users').whereLike('name', '%John');
|
|
176
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name LIKE ?');
|
|
177
|
-
this.expectBindings().to.deep.equal(['%John']);
|
|
178
|
-
}
|
|
179
|
-
async andWhere() {
|
|
180
|
-
this.query.table('users').where('name', 'John').andWhere('age', 18);
|
|
181
|
-
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? AND age = ?');
|
|
182
|
-
this.expectBindings().to.deep.equal(['John', 18]);
|
|
183
|
-
}
|
|
184
|
-
// @test
|
|
185
|
-
// async whereParameterGrouping() {
|
|
186
|
-
// this.query.table('users')
|
|
187
|
-
// .where('name', 'John')
|
|
188
|
-
// .where(query => query.where('age', 21).orWhere('role', 'Admin'));
|
|
189
|
-
//
|
|
190
|
-
// (await this.expectSql()).to.equal('SELECT * FROM users WHERE name = ? and (age = ? or role = ?)');
|
|
191
|
-
// this.expectBindings().to.deep.equal(['john', 21, 'Admin']);
|
|
192
|
-
// }
|
|
193
|
-
async orderBys() {
|
|
194
|
-
this.query.table('users').orderBy('age');
|
|
195
|
-
(await this.expect()).to.equal('SELECT * FROM users ORDER BY age DESC');
|
|
196
|
-
this.query.table('users').orderBy('age', 'ASC');
|
|
197
|
-
(await this.expect()).to.equal('SELECT * FROM users ORDER BY age ASC');
|
|
198
|
-
this.query.table('users').orderBy([['age', 'DESC'], ['email', 'ASC']]);
|
|
199
|
-
(await this.expect()).to.equal('SELECT * FROM users ORDER BY age DESC, email ASC');
|
|
200
|
-
}
|
|
201
|
-
async groupBy() {
|
|
202
|
-
this.query.table('users').groupBy('name');
|
|
203
|
-
(await this.expect()).to.equal('SELECT * FROM users GROUP BY name');
|
|
204
|
-
this.query.table('users').groupBy('city', 'country');
|
|
205
|
-
(await this.expect()).to.equal('SELECT * FROM users GROUP BY city, country');
|
|
206
|
-
}
|
|
207
|
-
async aggregateSelectCount() {
|
|
208
|
-
const query = await this.query.table('users').selectCount().get();
|
|
209
|
-
utils_1.expectQuery(query).toEqual('SELECT COUNT(*) as aggregate FROM users');
|
|
210
|
-
}
|
|
211
|
-
async aggregateCount() {
|
|
212
|
-
ts_mockito_1.when(this.connection.first(ts_mockito_1.anyOfClass(Database_1.Query))).thenCall((query) => {
|
|
213
|
-
return { aggregate: utils_1.trimSQL(query.toSQL()) };
|
|
214
|
-
});
|
|
215
|
-
chai_1.expect(await this.query.table('users').count()).to.equal('SELECT COUNT(*) as aggregate FROM users');
|
|
216
|
-
}
|
|
217
|
-
async aggregateMax() {
|
|
218
|
-
const query = await this.query.table('users').max('age');
|
|
219
|
-
utils_1.expectQuery(query).toEqual('SELECT MAX(age) as aggregate FROM users');
|
|
220
|
-
}
|
|
221
|
-
async limit() {
|
|
222
|
-
const query = await this.query.table('users').limit(10, 20).get();
|
|
223
|
-
utils_1.expectQuery(query).toEqual('SELECT * FROM users LIMIT 10, 20');
|
|
224
|
-
}
|
|
225
|
-
//
|
|
226
|
-
// @test
|
|
227
|
-
// async aggregateMax() {
|
|
228
|
-
// this.query.table('users').max('age');
|
|
229
|
-
// (await this.expectSql()).to.equal('SELECT MAX(age) as aggregate FROM users');
|
|
230
|
-
// }
|
|
231
|
-
async defaultJoin() {
|
|
232
|
-
this.query.table('users').join('pets', 'pets.user_id', '=', 'users.id');
|
|
233
|
-
(await this.expect()).to.equal('SELECT * FROM users INNER JOIN pets ON pets.user_id = users.id');
|
|
234
|
-
// this.new.query.table('users')
|
|
235
|
-
// .join('pets', 'pets.user_id', '=', 'users.id')
|
|
236
|
-
// .leftJoin('pet_types', 'pet_types.id', '=', 'pets.type_id');
|
|
237
|
-
// (await this.expectSql()).to
|
|
238
|
-
// .equal('SELECT * FROM users INNER JOIN pets ON pets.user_id = users.id LEFT JOIN pet_types ON pet_types.id = pets.type_id');
|
|
239
|
-
}
|
|
240
|
-
async innerJoin() {
|
|
241
|
-
this.query.table('users').innerJoin('pets', 'pets.user_id', '=', 'users.id');
|
|
242
|
-
(await this.expect()).to.equal('SELECT * FROM users INNER JOIN pets ON pets.user_id = users.id');
|
|
243
|
-
}
|
|
244
|
-
async leftJoin() {
|
|
245
|
-
this.query.table('users').leftJoin('pets', 'pets.user_id', '=', 'users.id');
|
|
246
|
-
(await this.expect()).to.equal('SELECT * FROM users LEFT JOIN pets ON pets.user_id = users.id');
|
|
247
|
-
}
|
|
248
|
-
async rightJoin() {
|
|
249
|
-
this.query.table('users').rightJoin('pets', 'pets.user_id', '=', 'users.id');
|
|
250
|
-
(await this.expect()).to.equal('SELECT * FROM users RIGHT JOIN pets ON pets.user_id = users.id');
|
|
251
|
-
}
|
|
252
|
-
async insertOneRow() {
|
|
253
|
-
this.query.table('users').insert({
|
|
254
|
-
name: 'John',
|
|
255
|
-
email: 'john@example.com'
|
|
256
|
-
});
|
|
257
|
-
(await this.expect()).to.equal('INSERT INTO users (name, email) VALUES (?, ?)');
|
|
258
|
-
this.expectBindings().to.deep.equal(['John', 'john@example.com']);
|
|
259
|
-
}
|
|
260
|
-
async insertManyRow() {
|
|
261
|
-
this.query.table('users').insert([
|
|
262
|
-
{
|
|
263
|
-
name: 'John',
|
|
264
|
-
email: 'john@example.com'
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
name: 'Chris',
|
|
268
|
-
email: 'chris@example.com'
|
|
269
|
-
}
|
|
270
|
-
]);
|
|
271
|
-
(await this.expect()).to.equal('INSERT INTO users (name, email) VALUES (?, ?), (?, ?)');
|
|
272
|
-
this.expectBindings().to.deep.equal(['John', 'john@example.com', 'Chris', 'chris@example.com']);
|
|
273
|
-
}
|
|
274
|
-
async delete() {
|
|
275
|
-
this.query.table('users').delete();
|
|
276
|
-
(await this.expect()).to.equal('DELETE FROM users');
|
|
277
|
-
}
|
|
278
|
-
async deletesWithCondition() {
|
|
279
|
-
this.query.table('users').where('name', 'John').delete();
|
|
280
|
-
(await this.expect()).to.equal('DELETE FROM users WHERE name = ?');
|
|
281
|
-
this.expectBindings().to.deep.equal(['John']);
|
|
282
|
-
}
|
|
283
|
-
async update() {
|
|
284
|
-
this.query.table('users').update('name', 'John');
|
|
285
|
-
(await this.expect()).to.equal('UPDATE users SET name = ?');
|
|
286
|
-
this.expectBindings().to.deep.equal(['John']);
|
|
287
|
-
}
|
|
288
|
-
async updateMultipleColumns() {
|
|
289
|
-
this.query.table('users').update({
|
|
290
|
-
name: 'John',
|
|
291
|
-
age: 21,
|
|
292
|
-
});
|
|
293
|
-
(await this.expect()).to.equal('UPDATE users SET name = ?, age = ?');
|
|
294
|
-
this.expectBindings().to.deep.equal(['John', 21]);
|
|
295
|
-
}
|
|
296
|
-
async updateWithCondition() {
|
|
297
|
-
this.query.table('users').where('name', 'John').update('name', 'Doe');
|
|
298
|
-
(await this.expect()).to.equal('UPDATE users SET name = ? WHERE name = ?');
|
|
299
|
-
this.expectBindings().to.deep.equal(['Doe', 'John']);
|
|
300
|
-
}
|
|
301
|
-
async subSelectWhereWithFunction() {
|
|
302
|
-
const query = Database_1.Query.table('users').where('id', q => {
|
|
303
|
-
q.select('userId').from('roles').where('id', 1);
|
|
304
|
-
});
|
|
305
|
-
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id = (SELECT userId FROM roles WHERE id = ?)');
|
|
306
|
-
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
307
|
-
}
|
|
308
|
-
async subSelectWhereWithDirectQuery() {
|
|
309
|
-
const query = Database_1.Query.table('users').where('id', new Database_1.Query().select('userId').from('roles').where('id', 1));
|
|
310
|
-
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id = (SELECT userId FROM roles WHERE id = ?)');
|
|
311
|
-
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
312
|
-
}
|
|
313
|
-
async subSelectWhereInWithFunction() {
|
|
314
|
-
const query = Database_1.Query.table('users').whereIn('id', q => {
|
|
315
|
-
q.select('userId').from('roles').where('id', 1);
|
|
316
|
-
});
|
|
317
|
-
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id IN (SELECT userId FROM roles WHERE id = ?)');
|
|
318
|
-
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
319
|
-
}
|
|
320
|
-
async subSelectWhereInWithDirectQuery() {
|
|
321
|
-
const query = Database_1.Query.table('users').whereIn('id', new Database_1.Query().select('userId').from('roles').where('id', 1));
|
|
322
|
-
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id IN (SELECT userId FROM roles WHERE id = ?)');
|
|
323
|
-
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
__decorate([
|
|
327
|
-
mocha_1.test,
|
|
328
|
-
__metadata("design:type", Function),
|
|
329
|
-
__metadata("design:paramtypes", []),
|
|
330
|
-
__metadata("design:returntype", Promise)
|
|
331
|
-
], QueryTest.prototype, "selectsEverything", null);
|
|
332
|
-
__decorate([
|
|
333
|
-
mocha_1.test,
|
|
334
|
-
__metadata("design:type", Function),
|
|
335
|
-
__metadata("design:paramtypes", []),
|
|
336
|
-
__metadata("design:returntype", Promise)
|
|
337
|
-
], QueryTest.prototype, "selectSpecificColumns", null);
|
|
338
|
-
__decorate([
|
|
339
|
-
mocha_1.test,
|
|
340
|
-
__metadata("design:type", Function),
|
|
341
|
-
__metadata("design:paramtypes", []),
|
|
342
|
-
__metadata("design:returntype", Promise)
|
|
343
|
-
], QueryTest.prototype, "addColumns", null);
|
|
344
|
-
__decorate([
|
|
345
|
-
mocha_1.test,
|
|
346
|
-
__metadata("design:type", Function),
|
|
347
|
-
__metadata("design:paramtypes", []),
|
|
348
|
-
__metadata("design:returntype", Promise)
|
|
349
|
-
], QueryTest.prototype, "selectDistinct", null);
|
|
350
|
-
__decorate([
|
|
351
|
-
mocha_1.test,
|
|
352
|
-
__metadata("design:type", Function),
|
|
353
|
-
__metadata("design:paramtypes", []),
|
|
354
|
-
__metadata("design:returntype", Promise)
|
|
355
|
-
], QueryTest.prototype, "first", null);
|
|
356
|
-
__decorate([
|
|
357
|
-
mocha_1.test,
|
|
358
|
-
__metadata("design:type", Function),
|
|
359
|
-
__metadata("design:paramtypes", []),
|
|
360
|
-
__metadata("design:returntype", Promise)
|
|
361
|
-
], QueryTest.prototype, "where", null);
|
|
362
|
-
__decorate([
|
|
363
|
-
mocha_1.test,
|
|
364
|
-
__metadata("design:type", Function),
|
|
365
|
-
__metadata("design:paramtypes", []),
|
|
366
|
-
__metadata("design:returntype", Promise)
|
|
367
|
-
], QueryTest.prototype, "whereWithDefaultOperator", null);
|
|
368
|
-
__decorate([
|
|
369
|
-
mocha_1.test,
|
|
370
|
-
__metadata("design:type", Function),
|
|
371
|
-
__metadata("design:paramtypes", []),
|
|
372
|
-
__metadata("design:returntype", Promise)
|
|
373
|
-
], QueryTest.prototype, "whereOrOperator", null);
|
|
374
|
-
__decorate([
|
|
375
|
-
mocha_1.test,
|
|
376
|
-
__metadata("design:type", Function),
|
|
377
|
-
__metadata("design:paramtypes", []),
|
|
378
|
-
__metadata("design:returntype", Promise)
|
|
379
|
-
], QueryTest.prototype, "whereBetween", null);
|
|
380
|
-
__decorate([
|
|
381
|
-
mocha_1.test,
|
|
382
|
-
__metadata("design:type", Function),
|
|
383
|
-
__metadata("design:paramtypes", []),
|
|
384
|
-
__metadata("design:returntype", Promise)
|
|
385
|
-
], QueryTest.prototype, "whereNotBetween", null);
|
|
386
|
-
__decorate([
|
|
387
|
-
mocha_1.test,
|
|
388
|
-
__metadata("design:type", Function),
|
|
389
|
-
__metadata("design:paramtypes", []),
|
|
390
|
-
__metadata("design:returntype", Promise)
|
|
391
|
-
], QueryTest.prototype, "orWhereBetween", null);
|
|
392
|
-
__decorate([
|
|
393
|
-
mocha_1.test,
|
|
394
|
-
__metadata("design:type", Function),
|
|
395
|
-
__metadata("design:paramtypes", []),
|
|
396
|
-
__metadata("design:returntype", Promise)
|
|
397
|
-
], QueryTest.prototype, "orWhereNotBetween", null);
|
|
398
|
-
__decorate([
|
|
399
|
-
mocha_1.test,
|
|
400
|
-
__metadata("design:type", Function),
|
|
401
|
-
__metadata("design:paramtypes", []),
|
|
402
|
-
__metadata("design:returntype", Promise)
|
|
403
|
-
], QueryTest.prototype, "whereIn", null);
|
|
404
|
-
__decorate([
|
|
405
|
-
mocha_1.test,
|
|
406
|
-
__metadata("design:type", Function),
|
|
407
|
-
__metadata("design:paramtypes", []),
|
|
408
|
-
__metadata("design:returntype", Promise)
|
|
409
|
-
], QueryTest.prototype, "whereNotIn", null);
|
|
410
|
-
__decorate([
|
|
411
|
-
mocha_1.test,
|
|
412
|
-
__metadata("design:type", Function),
|
|
413
|
-
__metadata("design:paramtypes", []),
|
|
414
|
-
__metadata("design:returntype", Promise)
|
|
415
|
-
], QueryTest.prototype, "orWhereIn", null);
|
|
416
|
-
__decorate([
|
|
417
|
-
mocha_1.test,
|
|
418
|
-
__metadata("design:type", Function),
|
|
419
|
-
__metadata("design:paramtypes", []),
|
|
420
|
-
__metadata("design:returntype", Promise)
|
|
421
|
-
], QueryTest.prototype, "orWhereNotIn", null);
|
|
422
|
-
__decorate([
|
|
423
|
-
mocha_1.test,
|
|
424
|
-
__metadata("design:type", Function),
|
|
425
|
-
__metadata("design:paramtypes", []),
|
|
426
|
-
__metadata("design:returntype", Promise)
|
|
427
|
-
], QueryTest.prototype, "whereNull", null);
|
|
428
|
-
__decorate([
|
|
429
|
-
mocha_1.test,
|
|
430
|
-
__metadata("design:type", Function),
|
|
431
|
-
__metadata("design:paramtypes", []),
|
|
432
|
-
__metadata("design:returntype", Promise)
|
|
433
|
-
], QueryTest.prototype, "andWhereNull", null);
|
|
434
|
-
__decorate([
|
|
435
|
-
mocha_1.test,
|
|
436
|
-
__metadata("design:type", Function),
|
|
437
|
-
__metadata("design:paramtypes", []),
|
|
438
|
-
__metadata("design:returntype", Promise)
|
|
439
|
-
], QueryTest.prototype, "whereNotNull", null);
|
|
440
|
-
__decorate([
|
|
441
|
-
mocha_1.test,
|
|
442
|
-
__metadata("design:type", Function),
|
|
443
|
-
__metadata("design:paramtypes", []),
|
|
444
|
-
__metadata("design:returntype", Promise)
|
|
445
|
-
], QueryTest.prototype, "andWhereNotNull", null);
|
|
446
|
-
__decorate([
|
|
447
|
-
mocha_1.test,
|
|
448
|
-
__metadata("design:type", Function),
|
|
449
|
-
__metadata("design:paramtypes", []),
|
|
450
|
-
__metadata("design:returntype", Promise)
|
|
451
|
-
], QueryTest.prototype, "orWhereNull", null);
|
|
452
|
-
__decorate([
|
|
453
|
-
mocha_1.test,
|
|
454
|
-
__metadata("design:type", Function),
|
|
455
|
-
__metadata("design:paramtypes", []),
|
|
456
|
-
__metadata("design:returntype", Promise)
|
|
457
|
-
], QueryTest.prototype, "orWhereNotNull", null);
|
|
458
|
-
__decorate([
|
|
459
|
-
mocha_1.test,
|
|
460
|
-
__metadata("design:type", Function),
|
|
461
|
-
__metadata("design:paramtypes", []),
|
|
462
|
-
__metadata("design:returntype", Promise)
|
|
463
|
-
], QueryTest.prototype, "orWhereLike", null);
|
|
464
|
-
__decorate([
|
|
465
|
-
mocha_1.test,
|
|
466
|
-
__metadata("design:type", Function),
|
|
467
|
-
__metadata("design:paramtypes", []),
|
|
468
|
-
__metadata("design:returntype", Promise)
|
|
469
|
-
], QueryTest.prototype, "orWhereNotLike", null);
|
|
470
|
-
__decorate([
|
|
471
|
-
mocha_1.test,
|
|
472
|
-
__metadata("design:type", Function),
|
|
473
|
-
__metadata("design:paramtypes", []),
|
|
474
|
-
__metadata("design:returntype", Promise)
|
|
475
|
-
], QueryTest.prototype, "andWhereIn", null);
|
|
476
|
-
__decorate([
|
|
477
|
-
mocha_1.test,
|
|
478
|
-
__metadata("design:type", Function),
|
|
479
|
-
__metadata("design:paramtypes", []),
|
|
480
|
-
__metadata("design:returntype", Promise)
|
|
481
|
-
], QueryTest.prototype, "andWhereNotIn", null);
|
|
482
|
-
__decorate([
|
|
483
|
-
mocha_1.test,
|
|
484
|
-
__metadata("design:type", Function),
|
|
485
|
-
__metadata("design:paramtypes", []),
|
|
486
|
-
__metadata("design:returntype", Promise)
|
|
487
|
-
], QueryTest.prototype, "whereLike", null);
|
|
488
|
-
__decorate([
|
|
489
|
-
mocha_1.test,
|
|
490
|
-
__metadata("design:type", Function),
|
|
491
|
-
__metadata("design:paramtypes", []),
|
|
492
|
-
__metadata("design:returntype", Promise)
|
|
493
|
-
], QueryTest.prototype, "andWhere", null);
|
|
494
|
-
__decorate([
|
|
495
|
-
mocha_1.test,
|
|
496
|
-
__metadata("design:type", Function),
|
|
497
|
-
__metadata("design:paramtypes", []),
|
|
498
|
-
__metadata("design:returntype", Promise)
|
|
499
|
-
], QueryTest.prototype, "orderBys", null);
|
|
500
|
-
__decorate([
|
|
501
|
-
mocha_1.test,
|
|
502
|
-
__metadata("design:type", Function),
|
|
503
|
-
__metadata("design:paramtypes", []),
|
|
504
|
-
__metadata("design:returntype", Promise)
|
|
505
|
-
], QueryTest.prototype, "groupBy", null);
|
|
506
|
-
__decorate([
|
|
507
|
-
mocha_1.test,
|
|
508
|
-
__metadata("design:type", Function),
|
|
509
|
-
__metadata("design:paramtypes", []),
|
|
510
|
-
__metadata("design:returntype", Promise)
|
|
511
|
-
], QueryTest.prototype, "aggregateSelectCount", null);
|
|
512
|
-
__decorate([
|
|
513
|
-
mocha_1.test,
|
|
514
|
-
__metadata("design:type", Function),
|
|
515
|
-
__metadata("design:paramtypes", []),
|
|
516
|
-
__metadata("design:returntype", Promise)
|
|
517
|
-
], QueryTest.prototype, "aggregateCount", null);
|
|
518
|
-
__decorate([
|
|
519
|
-
mocha_1.test,
|
|
520
|
-
__metadata("design:type", Function),
|
|
521
|
-
__metadata("design:paramtypes", []),
|
|
522
|
-
__metadata("design:returntype", Promise)
|
|
523
|
-
], QueryTest.prototype, "aggregateMax", null);
|
|
524
|
-
__decorate([
|
|
525
|
-
mocha_1.test,
|
|
526
|
-
__metadata("design:type", Function),
|
|
527
|
-
__metadata("design:paramtypes", []),
|
|
528
|
-
__metadata("design:returntype", Promise)
|
|
529
|
-
], QueryTest.prototype, "limit", null);
|
|
530
|
-
__decorate([
|
|
531
|
-
mocha_1.test,
|
|
532
|
-
__metadata("design:type", Function),
|
|
533
|
-
__metadata("design:paramtypes", []),
|
|
534
|
-
__metadata("design:returntype", Promise)
|
|
535
|
-
], QueryTest.prototype, "defaultJoin", null);
|
|
536
|
-
__decorate([
|
|
537
|
-
mocha_1.test,
|
|
538
|
-
__metadata("design:type", Function),
|
|
539
|
-
__metadata("design:paramtypes", []),
|
|
540
|
-
__metadata("design:returntype", Promise)
|
|
541
|
-
], QueryTest.prototype, "innerJoin", null);
|
|
542
|
-
__decorate([
|
|
543
|
-
mocha_1.test,
|
|
544
|
-
__metadata("design:type", Function),
|
|
545
|
-
__metadata("design:paramtypes", []),
|
|
546
|
-
__metadata("design:returntype", Promise)
|
|
547
|
-
], QueryTest.prototype, "leftJoin", null);
|
|
548
|
-
__decorate([
|
|
549
|
-
mocha_1.test,
|
|
550
|
-
__metadata("design:type", Function),
|
|
551
|
-
__metadata("design:paramtypes", []),
|
|
552
|
-
__metadata("design:returntype", Promise)
|
|
553
|
-
], QueryTest.prototype, "rightJoin", null);
|
|
554
|
-
__decorate([
|
|
555
|
-
mocha_1.test,
|
|
556
|
-
__metadata("design:type", Function),
|
|
557
|
-
__metadata("design:paramtypes", []),
|
|
558
|
-
__metadata("design:returntype", Promise)
|
|
559
|
-
], QueryTest.prototype, "insertOneRow", null);
|
|
560
|
-
__decorate([
|
|
561
|
-
mocha_1.test,
|
|
562
|
-
__metadata("design:type", Function),
|
|
563
|
-
__metadata("design:paramtypes", []),
|
|
564
|
-
__metadata("design:returntype", Promise)
|
|
565
|
-
], QueryTest.prototype, "insertManyRow", null);
|
|
566
|
-
__decorate([
|
|
567
|
-
mocha_1.test,
|
|
568
|
-
__metadata("design:type", Function),
|
|
569
|
-
__metadata("design:paramtypes", []),
|
|
570
|
-
__metadata("design:returntype", Promise)
|
|
571
|
-
], QueryTest.prototype, "delete", null);
|
|
572
|
-
__decorate([
|
|
573
|
-
mocha_1.test,
|
|
574
|
-
__metadata("design:type", Function),
|
|
575
|
-
__metadata("design:paramtypes", []),
|
|
576
|
-
__metadata("design:returntype", Promise)
|
|
577
|
-
], QueryTest.prototype, "deletesWithCondition", null);
|
|
578
|
-
__decorate([
|
|
579
|
-
mocha_1.test,
|
|
580
|
-
__metadata("design:type", Function),
|
|
581
|
-
__metadata("design:paramtypes", []),
|
|
582
|
-
__metadata("design:returntype", Promise)
|
|
583
|
-
], QueryTest.prototype, "update", null);
|
|
584
|
-
__decorate([
|
|
585
|
-
mocha_1.test,
|
|
586
|
-
__metadata("design:type", Function),
|
|
587
|
-
__metadata("design:paramtypes", []),
|
|
588
|
-
__metadata("design:returntype", Promise)
|
|
589
|
-
], QueryTest.prototype, "updateMultipleColumns", null);
|
|
590
|
-
__decorate([
|
|
591
|
-
mocha_1.test,
|
|
592
|
-
__metadata("design:type", Function),
|
|
593
|
-
__metadata("design:paramtypes", []),
|
|
594
|
-
__metadata("design:returntype", Promise)
|
|
595
|
-
], QueryTest.prototype, "updateWithCondition", null);
|
|
596
|
-
__decorate([
|
|
597
|
-
mocha_1.test,
|
|
598
|
-
__metadata("design:type", Function),
|
|
599
|
-
__metadata("design:paramtypes", []),
|
|
600
|
-
__metadata("design:returntype", Promise)
|
|
601
|
-
], QueryTest.prototype, "subSelectWhereWithFunction", null);
|
|
602
|
-
__decorate([
|
|
603
|
-
mocha_1.test,
|
|
604
|
-
__metadata("design:type", Function),
|
|
605
|
-
__metadata("design:paramtypes", []),
|
|
606
|
-
__metadata("design:returntype", Promise)
|
|
607
|
-
], QueryTest.prototype, "subSelectWhereWithDirectQuery", null);
|
|
608
|
-
__decorate([
|
|
609
|
-
mocha_1.test,
|
|
610
|
-
__metadata("design:type", Function),
|
|
611
|
-
__metadata("design:paramtypes", []),
|
|
612
|
-
__metadata("design:returntype", Promise)
|
|
613
|
-
], QueryTest.prototype, "subSelectWhereInWithFunction", null);
|
|
614
|
-
__decorate([
|
|
615
|
-
mocha_1.test,
|
|
616
|
-
__metadata("design:type", Function),
|
|
617
|
-
__metadata("design:paramtypes", []),
|
|
618
|
-
__metadata("design:returntype", Promise)
|
|
619
|
-
], QueryTest.prototype, "subSelectWhereInWithDirectQuery", null);
|
|
620
|
-
QueryTest = __decorate([
|
|
621
|
-
mocha_1.suite
|
|
622
|
-
], QueryTest);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const chai_1 = require("chai");
|
|
13
|
+
const mocha_1 = require("@testdeck/mocha");
|
|
14
|
+
const Database_1 = require("../../Database");
|
|
15
|
+
const ts_mockito_1 = require("ts-mockito");
|
|
16
|
+
const Drivers_1 = require("@Typetron/Database/Drivers");
|
|
17
|
+
const utils_1 = require("@Typetron/tests/Database/utils");
|
|
18
|
+
let QueryTest = class QueryTest {
|
|
19
|
+
before() {
|
|
20
|
+
this.connection = ts_mockito_1.mock(Database_1.Connection);
|
|
21
|
+
Database_1.Query.connection = ts_mockito_1.instance(this.connection);
|
|
22
|
+
Database_1.Query.connection.driver = new Drivers_1.SqliteDriver(':memory:');
|
|
23
|
+
ts_mockito_1.when(this.connection.get(ts_mockito_1.anyOfClass(Database_1.Query))).thenCall((query) => {
|
|
24
|
+
return query.toSQL();
|
|
25
|
+
});
|
|
26
|
+
this.query = new Database_1.Query();
|
|
27
|
+
}
|
|
28
|
+
async expect() {
|
|
29
|
+
return chai_1.expect(utils_1.trimSQL(await this.query.toSQL()));
|
|
30
|
+
}
|
|
31
|
+
expectBindings() {
|
|
32
|
+
return chai_1.expect(this.query.getBindings());
|
|
33
|
+
}
|
|
34
|
+
async selectsEverything() {
|
|
35
|
+
utils_1.expectQuery(Database_1.Query.table('users')).toEqual('SELECT * FROM users');
|
|
36
|
+
}
|
|
37
|
+
async selectSpecificColumns() {
|
|
38
|
+
utils_1.expectQuery(Database_1.Query.table('users').select('name', 'email')).toEqual('SELECT name, email FROM users');
|
|
39
|
+
}
|
|
40
|
+
async addColumns() {
|
|
41
|
+
utils_1.expectQuery(Database_1.Query.table('users').addSelect('name', 'email')).toEqual('SELECT name, email FROM users');
|
|
42
|
+
}
|
|
43
|
+
async selectDistinct() {
|
|
44
|
+
utils_1.expectQuery(Database_1.Query.table('users').distinct().select('name', 'email')).toEqual('SELECT DISTINCT name, email FROM users');
|
|
45
|
+
}
|
|
46
|
+
async first() {
|
|
47
|
+
ts_mockito_1.when(this.connection.first(ts_mockito_1.anyOfClass(Database_1.Query))).thenResolve({ name: 'John' });
|
|
48
|
+
const user = await this.query.table('users').first('name');
|
|
49
|
+
(await this.expect()).to.equal('SELECT name FROM users');
|
|
50
|
+
chai_1.expect(user).to.deep.equal({ name: 'John' });
|
|
51
|
+
}
|
|
52
|
+
async where() {
|
|
53
|
+
const query = Database_1.Query.table('users').where('name', '=', 'John');
|
|
54
|
+
utils_1.expectQuery(query).toEqual('SELECT * FROM users WHERE name = ?');
|
|
55
|
+
chai_1.expect(query.getBindings()).to.deep.equal(['John']);
|
|
56
|
+
}
|
|
57
|
+
async whereWithDefaultOperator() {
|
|
58
|
+
const query = Database_1.Query.table('users').where('name', 'John');
|
|
59
|
+
utils_1.expectQuery(query).toEqual('SELECT * FROM users WHERE name = ?');
|
|
60
|
+
chai_1.expect(query.getBindings()).to.deep.equal(['John']);
|
|
61
|
+
}
|
|
62
|
+
// @test
|
|
63
|
+
// async whereWithObject() {
|
|
64
|
+
// Query.table('users').where({name: 'John', age: 21});
|
|
65
|
+
//
|
|
66
|
+
// (await this.expectSql()).to.equal('SELECT * FROM users WHERE name = ? AND age = ?');
|
|
67
|
+
// this.expectBindings().to.deep.equal(['John', 21]);
|
|
68
|
+
// }
|
|
69
|
+
// @test
|
|
70
|
+
// async whereWithArray() {
|
|
71
|
+
// Query.table('users').where([
|
|
72
|
+
// ['name', '=', 'John'],
|
|
73
|
+
// ['age', '=', 21]
|
|
74
|
+
// ]);
|
|
75
|
+
//
|
|
76
|
+
// (await this.expectSql()).to.equal('SELECT * FROM users WHERE name = ? AND age = ?');
|
|
77
|
+
// this.expectBindings().to.deep.equal(['John', 21]);
|
|
78
|
+
// }
|
|
79
|
+
async whereOrOperator() {
|
|
80
|
+
this.query.table('users').where('name', 'John').orWhere('age', 21);
|
|
81
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age = ?');
|
|
82
|
+
this.expectBindings().to.deep.equal(['John', 21]);
|
|
83
|
+
}
|
|
84
|
+
async whereBetween() {
|
|
85
|
+
this.query.table('users').whereBetween('age', [18, 25]);
|
|
86
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age BETWEEN ? AND ?');
|
|
87
|
+
this.expectBindings().to.deep.equal([18, 25]);
|
|
88
|
+
}
|
|
89
|
+
async whereNotBetween() {
|
|
90
|
+
this.query.table('users').whereNotBetween('age', [18, 25]);
|
|
91
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age NOT BETWEEN ? AND ?');
|
|
92
|
+
this.expectBindings().to.deep.equal([18, 25]);
|
|
93
|
+
}
|
|
94
|
+
async orWhereBetween() {
|
|
95
|
+
this.query.table('users').where('name', 'John').orWhereBetween('age', [18, 25]);
|
|
96
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age BETWEEN ? AND ?');
|
|
97
|
+
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
98
|
+
}
|
|
99
|
+
async orWhereNotBetween() {
|
|
100
|
+
this.query.table('users').where('name', 'John').orWhereNotBetween('age', [18, 25]);
|
|
101
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age NOT BETWEEN ? AND ?');
|
|
102
|
+
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
103
|
+
}
|
|
104
|
+
async whereIn() {
|
|
105
|
+
this.query.table('users').whereIn('age', [18, 25]);
|
|
106
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age IN (?, ?)');
|
|
107
|
+
this.expectBindings().to.deep.equal([18, 25]);
|
|
108
|
+
}
|
|
109
|
+
async whereNotIn() {
|
|
110
|
+
this.query.table('users').whereNotIn('age', [18, 25]);
|
|
111
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age NOT IN (?, ?)');
|
|
112
|
+
this.expectBindings().to.deep.equal([18, 25]);
|
|
113
|
+
}
|
|
114
|
+
async orWhereIn() {
|
|
115
|
+
this.query.table('users').where('name', 'John').orWhereIn('age', [18, 25]);
|
|
116
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age IN (?, ?)');
|
|
117
|
+
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
118
|
+
}
|
|
119
|
+
async orWhereNotIn() {
|
|
120
|
+
this.query.table('users').where('name', 'John').orWhereNotIn('age', [18, 25]);
|
|
121
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age NOT IN (?, ?)');
|
|
122
|
+
this.expectBindings().to.deep.equal(['John', 18, 25]);
|
|
123
|
+
}
|
|
124
|
+
async whereNull() {
|
|
125
|
+
this.query.table('users').whereNull('age');
|
|
126
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NULL');
|
|
127
|
+
this.expectBindings().to.deep.equal([]);
|
|
128
|
+
}
|
|
129
|
+
async andWhereNull() {
|
|
130
|
+
this.query.table('users').andWhereNull('age');
|
|
131
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NULL');
|
|
132
|
+
this.expectBindings().to.deep.equal([]);
|
|
133
|
+
}
|
|
134
|
+
async whereNotNull() {
|
|
135
|
+
this.query.table('users').whereNotNull('age');
|
|
136
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NOT NULL');
|
|
137
|
+
this.expectBindings().to.deep.equal([]);
|
|
138
|
+
}
|
|
139
|
+
async andWhereNotNull() {
|
|
140
|
+
this.query.table('users').andWhereNotNull('age');
|
|
141
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age IS NOT NULL');
|
|
142
|
+
this.expectBindings().to.deep.equal([]);
|
|
143
|
+
}
|
|
144
|
+
async orWhereNull() {
|
|
145
|
+
this.query.table('users').where('name', 'John').orWhereNull('age');
|
|
146
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age IS NULL');
|
|
147
|
+
this.expectBindings().to.deep.equal(['John']);
|
|
148
|
+
}
|
|
149
|
+
async orWhereNotNull() {
|
|
150
|
+
this.query.table('users').where('name', 'John').orWhereNotNull('age');
|
|
151
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? OR age IS NOT NULL');
|
|
152
|
+
this.expectBindings().to.deep.equal(['John']);
|
|
153
|
+
}
|
|
154
|
+
async orWhereLike() {
|
|
155
|
+
this.query.table('users').where('age', 18).orWhereLike('name', '%John');
|
|
156
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? OR name LIKE ?');
|
|
157
|
+
this.expectBindings().to.deep.equal([18, '%John']);
|
|
158
|
+
}
|
|
159
|
+
async orWhereNotLike() {
|
|
160
|
+
this.query.table('users').where('age', 18).orWhereNotLike('name', '%John');
|
|
161
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? OR name NOT LIKE ?');
|
|
162
|
+
this.expectBindings().to.deep.equal([18, '%John']);
|
|
163
|
+
}
|
|
164
|
+
async andWhereIn() {
|
|
165
|
+
this.query.table('users').where('age', 18).andWhereIn('name', ['John', 'Doe']);
|
|
166
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? AND name IN (?, ?)');
|
|
167
|
+
this.expectBindings().to.deep.equal([18, 'John', 'Doe']);
|
|
168
|
+
}
|
|
169
|
+
async andWhereNotIn() {
|
|
170
|
+
this.query.table('users').where('age', 18).andWhereNotIn('name', ['John', 'Doe']);
|
|
171
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE age = ? AND name NOT IN (?, ?)');
|
|
172
|
+
this.expectBindings().to.deep.equal([18, 'John', 'Doe']);
|
|
173
|
+
}
|
|
174
|
+
async whereLike() {
|
|
175
|
+
this.query.table('users').whereLike('name', '%John');
|
|
176
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name LIKE ?');
|
|
177
|
+
this.expectBindings().to.deep.equal(['%John']);
|
|
178
|
+
}
|
|
179
|
+
async andWhere() {
|
|
180
|
+
this.query.table('users').where('name', 'John').andWhere('age', 18);
|
|
181
|
+
(await this.expect()).to.equal('SELECT * FROM users WHERE name = ? AND age = ?');
|
|
182
|
+
this.expectBindings().to.deep.equal(['John', 18]);
|
|
183
|
+
}
|
|
184
|
+
// @test
|
|
185
|
+
// async whereParameterGrouping() {
|
|
186
|
+
// this.query.table('users')
|
|
187
|
+
// .where('name', 'John')
|
|
188
|
+
// .where(query => query.where('age', 21).orWhere('role', 'Admin'));
|
|
189
|
+
//
|
|
190
|
+
// (await this.expectSql()).to.equal('SELECT * FROM users WHERE name = ? and (age = ? or role = ?)');
|
|
191
|
+
// this.expectBindings().to.deep.equal(['john', 21, 'Admin']);
|
|
192
|
+
// }
|
|
193
|
+
async orderBys() {
|
|
194
|
+
this.query.table('users').orderBy('age');
|
|
195
|
+
(await this.expect()).to.equal('SELECT * FROM users ORDER BY age DESC');
|
|
196
|
+
this.query.table('users').orderBy('age', 'ASC');
|
|
197
|
+
(await this.expect()).to.equal('SELECT * FROM users ORDER BY age ASC');
|
|
198
|
+
this.query.table('users').orderBy([['age', 'DESC'], ['email', 'ASC']]);
|
|
199
|
+
(await this.expect()).to.equal('SELECT * FROM users ORDER BY age DESC, email ASC');
|
|
200
|
+
}
|
|
201
|
+
async groupBy() {
|
|
202
|
+
this.query.table('users').groupBy('name');
|
|
203
|
+
(await this.expect()).to.equal('SELECT * FROM users GROUP BY name');
|
|
204
|
+
this.query.table('users').groupBy('city', 'country');
|
|
205
|
+
(await this.expect()).to.equal('SELECT * FROM users GROUP BY city, country');
|
|
206
|
+
}
|
|
207
|
+
async aggregateSelectCount() {
|
|
208
|
+
const query = await this.query.table('users').selectCount().get();
|
|
209
|
+
utils_1.expectQuery(query).toEqual('SELECT COUNT(*) as aggregate FROM users');
|
|
210
|
+
}
|
|
211
|
+
async aggregateCount() {
|
|
212
|
+
ts_mockito_1.when(this.connection.first(ts_mockito_1.anyOfClass(Database_1.Query))).thenCall((query) => {
|
|
213
|
+
return { aggregate: utils_1.trimSQL(query.toSQL()) };
|
|
214
|
+
});
|
|
215
|
+
chai_1.expect(await this.query.table('users').count()).to.equal('SELECT COUNT(*) as aggregate FROM users');
|
|
216
|
+
}
|
|
217
|
+
async aggregateMax() {
|
|
218
|
+
const query = await this.query.table('users').max('age');
|
|
219
|
+
utils_1.expectQuery(query).toEqual('SELECT MAX(age) as aggregate FROM users');
|
|
220
|
+
}
|
|
221
|
+
async limit() {
|
|
222
|
+
const query = await this.query.table('users').limit(10, 20).get();
|
|
223
|
+
utils_1.expectQuery(query).toEqual('SELECT * FROM users LIMIT 10, 20');
|
|
224
|
+
}
|
|
225
|
+
//
|
|
226
|
+
// @test
|
|
227
|
+
// async aggregateMax() {
|
|
228
|
+
// this.query.table('users').max('age');
|
|
229
|
+
// (await this.expectSql()).to.equal('SELECT MAX(age) as aggregate FROM users');
|
|
230
|
+
// }
|
|
231
|
+
async defaultJoin() {
|
|
232
|
+
this.query.table('users').join('pets', 'pets.user_id', '=', 'users.id');
|
|
233
|
+
(await this.expect()).to.equal('SELECT * FROM users INNER JOIN pets ON pets.user_id = users.id');
|
|
234
|
+
// this.new.query.table('users')
|
|
235
|
+
// .join('pets', 'pets.user_id', '=', 'users.id')
|
|
236
|
+
// .leftJoin('pet_types', 'pet_types.id', '=', 'pets.type_id');
|
|
237
|
+
// (await this.expectSql()).to
|
|
238
|
+
// .equal('SELECT * FROM users INNER JOIN pets ON pets.user_id = users.id LEFT JOIN pet_types ON pet_types.id = pets.type_id');
|
|
239
|
+
}
|
|
240
|
+
async innerJoin() {
|
|
241
|
+
this.query.table('users').innerJoin('pets', 'pets.user_id', '=', 'users.id');
|
|
242
|
+
(await this.expect()).to.equal('SELECT * FROM users INNER JOIN pets ON pets.user_id = users.id');
|
|
243
|
+
}
|
|
244
|
+
async leftJoin() {
|
|
245
|
+
this.query.table('users').leftJoin('pets', 'pets.user_id', '=', 'users.id');
|
|
246
|
+
(await this.expect()).to.equal('SELECT * FROM users LEFT JOIN pets ON pets.user_id = users.id');
|
|
247
|
+
}
|
|
248
|
+
async rightJoin() {
|
|
249
|
+
this.query.table('users').rightJoin('pets', 'pets.user_id', '=', 'users.id');
|
|
250
|
+
(await this.expect()).to.equal('SELECT * FROM users RIGHT JOIN pets ON pets.user_id = users.id');
|
|
251
|
+
}
|
|
252
|
+
async insertOneRow() {
|
|
253
|
+
this.query.table('users').insert({
|
|
254
|
+
name: 'John',
|
|
255
|
+
email: 'john@example.com'
|
|
256
|
+
});
|
|
257
|
+
(await this.expect()).to.equal('INSERT INTO users (name, email) VALUES (?, ?)');
|
|
258
|
+
this.expectBindings().to.deep.equal(['John', 'john@example.com']);
|
|
259
|
+
}
|
|
260
|
+
async insertManyRow() {
|
|
261
|
+
this.query.table('users').insert([
|
|
262
|
+
{
|
|
263
|
+
name: 'John',
|
|
264
|
+
email: 'john@example.com'
|
|
265
|
+
},
|
|
266
|
+
{
|
|
267
|
+
name: 'Chris',
|
|
268
|
+
email: 'chris@example.com'
|
|
269
|
+
}
|
|
270
|
+
]);
|
|
271
|
+
(await this.expect()).to.equal('INSERT INTO users (name, email) VALUES (?, ?), (?, ?)');
|
|
272
|
+
this.expectBindings().to.deep.equal(['John', 'john@example.com', 'Chris', 'chris@example.com']);
|
|
273
|
+
}
|
|
274
|
+
async delete() {
|
|
275
|
+
this.query.table('users').delete();
|
|
276
|
+
(await this.expect()).to.equal('DELETE FROM users');
|
|
277
|
+
}
|
|
278
|
+
async deletesWithCondition() {
|
|
279
|
+
this.query.table('users').where('name', 'John').delete();
|
|
280
|
+
(await this.expect()).to.equal('DELETE FROM users WHERE name = ?');
|
|
281
|
+
this.expectBindings().to.deep.equal(['John']);
|
|
282
|
+
}
|
|
283
|
+
async update() {
|
|
284
|
+
this.query.table('users').update('name', 'John');
|
|
285
|
+
(await this.expect()).to.equal('UPDATE users SET name = ?');
|
|
286
|
+
this.expectBindings().to.deep.equal(['John']);
|
|
287
|
+
}
|
|
288
|
+
async updateMultipleColumns() {
|
|
289
|
+
this.query.table('users').update({
|
|
290
|
+
name: 'John',
|
|
291
|
+
age: 21,
|
|
292
|
+
});
|
|
293
|
+
(await this.expect()).to.equal('UPDATE users SET name = ?, age = ?');
|
|
294
|
+
this.expectBindings().to.deep.equal(['John', 21]);
|
|
295
|
+
}
|
|
296
|
+
async updateWithCondition() {
|
|
297
|
+
this.query.table('users').where('name', 'John').update('name', 'Doe');
|
|
298
|
+
(await this.expect()).to.equal('UPDATE users SET name = ? WHERE name = ?');
|
|
299
|
+
this.expectBindings().to.deep.equal(['Doe', 'John']);
|
|
300
|
+
}
|
|
301
|
+
async subSelectWhereWithFunction() {
|
|
302
|
+
const query = Database_1.Query.table('users').where('id', q => {
|
|
303
|
+
q.select('userId').from('roles').where('id', 1);
|
|
304
|
+
});
|
|
305
|
+
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id = (SELECT userId FROM roles WHERE id = ?)');
|
|
306
|
+
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
307
|
+
}
|
|
308
|
+
async subSelectWhereWithDirectQuery() {
|
|
309
|
+
const query = Database_1.Query.table('users').where('id', new Database_1.Query().select('userId').from('roles').where('id', 1));
|
|
310
|
+
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id = (SELECT userId FROM roles WHERE id = ?)');
|
|
311
|
+
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
312
|
+
}
|
|
313
|
+
async subSelectWhereInWithFunction() {
|
|
314
|
+
const query = Database_1.Query.table('users').whereIn('id', q => {
|
|
315
|
+
q.select('userId').from('roles').where('id', 1);
|
|
316
|
+
});
|
|
317
|
+
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id IN (SELECT userId FROM roles WHERE id = ?)');
|
|
318
|
+
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
319
|
+
}
|
|
320
|
+
async subSelectWhereInWithDirectQuery() {
|
|
321
|
+
const query = Database_1.Query.table('users').whereIn('id', new Database_1.Query().select('userId').from('roles').where('id', 1));
|
|
322
|
+
chai_1.expect(utils_1.trimSQL(query.toSQL())).to.equal('SELECT * FROM users WHERE id IN (SELECT userId FROM roles WHERE id = ?)');
|
|
323
|
+
chai_1.expect(query.getBindings()).to.deep.equal([1]);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
__decorate([
|
|
327
|
+
mocha_1.test,
|
|
328
|
+
__metadata("design:type", Function),
|
|
329
|
+
__metadata("design:paramtypes", []),
|
|
330
|
+
__metadata("design:returntype", Promise)
|
|
331
|
+
], QueryTest.prototype, "selectsEverything", null);
|
|
332
|
+
__decorate([
|
|
333
|
+
mocha_1.test,
|
|
334
|
+
__metadata("design:type", Function),
|
|
335
|
+
__metadata("design:paramtypes", []),
|
|
336
|
+
__metadata("design:returntype", Promise)
|
|
337
|
+
], QueryTest.prototype, "selectSpecificColumns", null);
|
|
338
|
+
__decorate([
|
|
339
|
+
mocha_1.test,
|
|
340
|
+
__metadata("design:type", Function),
|
|
341
|
+
__metadata("design:paramtypes", []),
|
|
342
|
+
__metadata("design:returntype", Promise)
|
|
343
|
+
], QueryTest.prototype, "addColumns", null);
|
|
344
|
+
__decorate([
|
|
345
|
+
mocha_1.test,
|
|
346
|
+
__metadata("design:type", Function),
|
|
347
|
+
__metadata("design:paramtypes", []),
|
|
348
|
+
__metadata("design:returntype", Promise)
|
|
349
|
+
], QueryTest.prototype, "selectDistinct", null);
|
|
350
|
+
__decorate([
|
|
351
|
+
mocha_1.test,
|
|
352
|
+
__metadata("design:type", Function),
|
|
353
|
+
__metadata("design:paramtypes", []),
|
|
354
|
+
__metadata("design:returntype", Promise)
|
|
355
|
+
], QueryTest.prototype, "first", null);
|
|
356
|
+
__decorate([
|
|
357
|
+
mocha_1.test,
|
|
358
|
+
__metadata("design:type", Function),
|
|
359
|
+
__metadata("design:paramtypes", []),
|
|
360
|
+
__metadata("design:returntype", Promise)
|
|
361
|
+
], QueryTest.prototype, "where", null);
|
|
362
|
+
__decorate([
|
|
363
|
+
mocha_1.test,
|
|
364
|
+
__metadata("design:type", Function),
|
|
365
|
+
__metadata("design:paramtypes", []),
|
|
366
|
+
__metadata("design:returntype", Promise)
|
|
367
|
+
], QueryTest.prototype, "whereWithDefaultOperator", null);
|
|
368
|
+
__decorate([
|
|
369
|
+
mocha_1.test,
|
|
370
|
+
__metadata("design:type", Function),
|
|
371
|
+
__metadata("design:paramtypes", []),
|
|
372
|
+
__metadata("design:returntype", Promise)
|
|
373
|
+
], QueryTest.prototype, "whereOrOperator", null);
|
|
374
|
+
__decorate([
|
|
375
|
+
mocha_1.test,
|
|
376
|
+
__metadata("design:type", Function),
|
|
377
|
+
__metadata("design:paramtypes", []),
|
|
378
|
+
__metadata("design:returntype", Promise)
|
|
379
|
+
], QueryTest.prototype, "whereBetween", null);
|
|
380
|
+
__decorate([
|
|
381
|
+
mocha_1.test,
|
|
382
|
+
__metadata("design:type", Function),
|
|
383
|
+
__metadata("design:paramtypes", []),
|
|
384
|
+
__metadata("design:returntype", Promise)
|
|
385
|
+
], QueryTest.prototype, "whereNotBetween", null);
|
|
386
|
+
__decorate([
|
|
387
|
+
mocha_1.test,
|
|
388
|
+
__metadata("design:type", Function),
|
|
389
|
+
__metadata("design:paramtypes", []),
|
|
390
|
+
__metadata("design:returntype", Promise)
|
|
391
|
+
], QueryTest.prototype, "orWhereBetween", null);
|
|
392
|
+
__decorate([
|
|
393
|
+
mocha_1.test,
|
|
394
|
+
__metadata("design:type", Function),
|
|
395
|
+
__metadata("design:paramtypes", []),
|
|
396
|
+
__metadata("design:returntype", Promise)
|
|
397
|
+
], QueryTest.prototype, "orWhereNotBetween", null);
|
|
398
|
+
__decorate([
|
|
399
|
+
mocha_1.test,
|
|
400
|
+
__metadata("design:type", Function),
|
|
401
|
+
__metadata("design:paramtypes", []),
|
|
402
|
+
__metadata("design:returntype", Promise)
|
|
403
|
+
], QueryTest.prototype, "whereIn", null);
|
|
404
|
+
__decorate([
|
|
405
|
+
mocha_1.test,
|
|
406
|
+
__metadata("design:type", Function),
|
|
407
|
+
__metadata("design:paramtypes", []),
|
|
408
|
+
__metadata("design:returntype", Promise)
|
|
409
|
+
], QueryTest.prototype, "whereNotIn", null);
|
|
410
|
+
__decorate([
|
|
411
|
+
mocha_1.test,
|
|
412
|
+
__metadata("design:type", Function),
|
|
413
|
+
__metadata("design:paramtypes", []),
|
|
414
|
+
__metadata("design:returntype", Promise)
|
|
415
|
+
], QueryTest.prototype, "orWhereIn", null);
|
|
416
|
+
__decorate([
|
|
417
|
+
mocha_1.test,
|
|
418
|
+
__metadata("design:type", Function),
|
|
419
|
+
__metadata("design:paramtypes", []),
|
|
420
|
+
__metadata("design:returntype", Promise)
|
|
421
|
+
], QueryTest.prototype, "orWhereNotIn", null);
|
|
422
|
+
__decorate([
|
|
423
|
+
mocha_1.test,
|
|
424
|
+
__metadata("design:type", Function),
|
|
425
|
+
__metadata("design:paramtypes", []),
|
|
426
|
+
__metadata("design:returntype", Promise)
|
|
427
|
+
], QueryTest.prototype, "whereNull", null);
|
|
428
|
+
__decorate([
|
|
429
|
+
mocha_1.test,
|
|
430
|
+
__metadata("design:type", Function),
|
|
431
|
+
__metadata("design:paramtypes", []),
|
|
432
|
+
__metadata("design:returntype", Promise)
|
|
433
|
+
], QueryTest.prototype, "andWhereNull", null);
|
|
434
|
+
__decorate([
|
|
435
|
+
mocha_1.test,
|
|
436
|
+
__metadata("design:type", Function),
|
|
437
|
+
__metadata("design:paramtypes", []),
|
|
438
|
+
__metadata("design:returntype", Promise)
|
|
439
|
+
], QueryTest.prototype, "whereNotNull", null);
|
|
440
|
+
__decorate([
|
|
441
|
+
mocha_1.test,
|
|
442
|
+
__metadata("design:type", Function),
|
|
443
|
+
__metadata("design:paramtypes", []),
|
|
444
|
+
__metadata("design:returntype", Promise)
|
|
445
|
+
], QueryTest.prototype, "andWhereNotNull", null);
|
|
446
|
+
__decorate([
|
|
447
|
+
mocha_1.test,
|
|
448
|
+
__metadata("design:type", Function),
|
|
449
|
+
__metadata("design:paramtypes", []),
|
|
450
|
+
__metadata("design:returntype", Promise)
|
|
451
|
+
], QueryTest.prototype, "orWhereNull", null);
|
|
452
|
+
__decorate([
|
|
453
|
+
mocha_1.test,
|
|
454
|
+
__metadata("design:type", Function),
|
|
455
|
+
__metadata("design:paramtypes", []),
|
|
456
|
+
__metadata("design:returntype", Promise)
|
|
457
|
+
], QueryTest.prototype, "orWhereNotNull", null);
|
|
458
|
+
__decorate([
|
|
459
|
+
mocha_1.test,
|
|
460
|
+
__metadata("design:type", Function),
|
|
461
|
+
__metadata("design:paramtypes", []),
|
|
462
|
+
__metadata("design:returntype", Promise)
|
|
463
|
+
], QueryTest.prototype, "orWhereLike", null);
|
|
464
|
+
__decorate([
|
|
465
|
+
mocha_1.test,
|
|
466
|
+
__metadata("design:type", Function),
|
|
467
|
+
__metadata("design:paramtypes", []),
|
|
468
|
+
__metadata("design:returntype", Promise)
|
|
469
|
+
], QueryTest.prototype, "orWhereNotLike", null);
|
|
470
|
+
__decorate([
|
|
471
|
+
mocha_1.test,
|
|
472
|
+
__metadata("design:type", Function),
|
|
473
|
+
__metadata("design:paramtypes", []),
|
|
474
|
+
__metadata("design:returntype", Promise)
|
|
475
|
+
], QueryTest.prototype, "andWhereIn", null);
|
|
476
|
+
__decorate([
|
|
477
|
+
mocha_1.test,
|
|
478
|
+
__metadata("design:type", Function),
|
|
479
|
+
__metadata("design:paramtypes", []),
|
|
480
|
+
__metadata("design:returntype", Promise)
|
|
481
|
+
], QueryTest.prototype, "andWhereNotIn", null);
|
|
482
|
+
__decorate([
|
|
483
|
+
mocha_1.test,
|
|
484
|
+
__metadata("design:type", Function),
|
|
485
|
+
__metadata("design:paramtypes", []),
|
|
486
|
+
__metadata("design:returntype", Promise)
|
|
487
|
+
], QueryTest.prototype, "whereLike", null);
|
|
488
|
+
__decorate([
|
|
489
|
+
mocha_1.test,
|
|
490
|
+
__metadata("design:type", Function),
|
|
491
|
+
__metadata("design:paramtypes", []),
|
|
492
|
+
__metadata("design:returntype", Promise)
|
|
493
|
+
], QueryTest.prototype, "andWhere", null);
|
|
494
|
+
__decorate([
|
|
495
|
+
mocha_1.test,
|
|
496
|
+
__metadata("design:type", Function),
|
|
497
|
+
__metadata("design:paramtypes", []),
|
|
498
|
+
__metadata("design:returntype", Promise)
|
|
499
|
+
], QueryTest.prototype, "orderBys", null);
|
|
500
|
+
__decorate([
|
|
501
|
+
mocha_1.test,
|
|
502
|
+
__metadata("design:type", Function),
|
|
503
|
+
__metadata("design:paramtypes", []),
|
|
504
|
+
__metadata("design:returntype", Promise)
|
|
505
|
+
], QueryTest.prototype, "groupBy", null);
|
|
506
|
+
__decorate([
|
|
507
|
+
mocha_1.test,
|
|
508
|
+
__metadata("design:type", Function),
|
|
509
|
+
__metadata("design:paramtypes", []),
|
|
510
|
+
__metadata("design:returntype", Promise)
|
|
511
|
+
], QueryTest.prototype, "aggregateSelectCount", null);
|
|
512
|
+
__decorate([
|
|
513
|
+
mocha_1.test,
|
|
514
|
+
__metadata("design:type", Function),
|
|
515
|
+
__metadata("design:paramtypes", []),
|
|
516
|
+
__metadata("design:returntype", Promise)
|
|
517
|
+
], QueryTest.prototype, "aggregateCount", null);
|
|
518
|
+
__decorate([
|
|
519
|
+
mocha_1.test,
|
|
520
|
+
__metadata("design:type", Function),
|
|
521
|
+
__metadata("design:paramtypes", []),
|
|
522
|
+
__metadata("design:returntype", Promise)
|
|
523
|
+
], QueryTest.prototype, "aggregateMax", null);
|
|
524
|
+
__decorate([
|
|
525
|
+
mocha_1.test,
|
|
526
|
+
__metadata("design:type", Function),
|
|
527
|
+
__metadata("design:paramtypes", []),
|
|
528
|
+
__metadata("design:returntype", Promise)
|
|
529
|
+
], QueryTest.prototype, "limit", null);
|
|
530
|
+
__decorate([
|
|
531
|
+
mocha_1.test,
|
|
532
|
+
__metadata("design:type", Function),
|
|
533
|
+
__metadata("design:paramtypes", []),
|
|
534
|
+
__metadata("design:returntype", Promise)
|
|
535
|
+
], QueryTest.prototype, "defaultJoin", null);
|
|
536
|
+
__decorate([
|
|
537
|
+
mocha_1.test,
|
|
538
|
+
__metadata("design:type", Function),
|
|
539
|
+
__metadata("design:paramtypes", []),
|
|
540
|
+
__metadata("design:returntype", Promise)
|
|
541
|
+
], QueryTest.prototype, "innerJoin", null);
|
|
542
|
+
__decorate([
|
|
543
|
+
mocha_1.test,
|
|
544
|
+
__metadata("design:type", Function),
|
|
545
|
+
__metadata("design:paramtypes", []),
|
|
546
|
+
__metadata("design:returntype", Promise)
|
|
547
|
+
], QueryTest.prototype, "leftJoin", null);
|
|
548
|
+
__decorate([
|
|
549
|
+
mocha_1.test,
|
|
550
|
+
__metadata("design:type", Function),
|
|
551
|
+
__metadata("design:paramtypes", []),
|
|
552
|
+
__metadata("design:returntype", Promise)
|
|
553
|
+
], QueryTest.prototype, "rightJoin", null);
|
|
554
|
+
__decorate([
|
|
555
|
+
mocha_1.test,
|
|
556
|
+
__metadata("design:type", Function),
|
|
557
|
+
__metadata("design:paramtypes", []),
|
|
558
|
+
__metadata("design:returntype", Promise)
|
|
559
|
+
], QueryTest.prototype, "insertOneRow", null);
|
|
560
|
+
__decorate([
|
|
561
|
+
mocha_1.test,
|
|
562
|
+
__metadata("design:type", Function),
|
|
563
|
+
__metadata("design:paramtypes", []),
|
|
564
|
+
__metadata("design:returntype", Promise)
|
|
565
|
+
], QueryTest.prototype, "insertManyRow", null);
|
|
566
|
+
__decorate([
|
|
567
|
+
mocha_1.test,
|
|
568
|
+
__metadata("design:type", Function),
|
|
569
|
+
__metadata("design:paramtypes", []),
|
|
570
|
+
__metadata("design:returntype", Promise)
|
|
571
|
+
], QueryTest.prototype, "delete", null);
|
|
572
|
+
__decorate([
|
|
573
|
+
mocha_1.test,
|
|
574
|
+
__metadata("design:type", Function),
|
|
575
|
+
__metadata("design:paramtypes", []),
|
|
576
|
+
__metadata("design:returntype", Promise)
|
|
577
|
+
], QueryTest.prototype, "deletesWithCondition", null);
|
|
578
|
+
__decorate([
|
|
579
|
+
mocha_1.test,
|
|
580
|
+
__metadata("design:type", Function),
|
|
581
|
+
__metadata("design:paramtypes", []),
|
|
582
|
+
__metadata("design:returntype", Promise)
|
|
583
|
+
], QueryTest.prototype, "update", null);
|
|
584
|
+
__decorate([
|
|
585
|
+
mocha_1.test,
|
|
586
|
+
__metadata("design:type", Function),
|
|
587
|
+
__metadata("design:paramtypes", []),
|
|
588
|
+
__metadata("design:returntype", Promise)
|
|
589
|
+
], QueryTest.prototype, "updateMultipleColumns", null);
|
|
590
|
+
__decorate([
|
|
591
|
+
mocha_1.test,
|
|
592
|
+
__metadata("design:type", Function),
|
|
593
|
+
__metadata("design:paramtypes", []),
|
|
594
|
+
__metadata("design:returntype", Promise)
|
|
595
|
+
], QueryTest.prototype, "updateWithCondition", null);
|
|
596
|
+
__decorate([
|
|
597
|
+
mocha_1.test,
|
|
598
|
+
__metadata("design:type", Function),
|
|
599
|
+
__metadata("design:paramtypes", []),
|
|
600
|
+
__metadata("design:returntype", Promise)
|
|
601
|
+
], QueryTest.prototype, "subSelectWhereWithFunction", null);
|
|
602
|
+
__decorate([
|
|
603
|
+
mocha_1.test,
|
|
604
|
+
__metadata("design:type", Function),
|
|
605
|
+
__metadata("design:paramtypes", []),
|
|
606
|
+
__metadata("design:returntype", Promise)
|
|
607
|
+
], QueryTest.prototype, "subSelectWhereWithDirectQuery", null);
|
|
608
|
+
__decorate([
|
|
609
|
+
mocha_1.test,
|
|
610
|
+
__metadata("design:type", Function),
|
|
611
|
+
__metadata("design:paramtypes", []),
|
|
612
|
+
__metadata("design:returntype", Promise)
|
|
613
|
+
], QueryTest.prototype, "subSelectWhereInWithFunction", null);
|
|
614
|
+
__decorate([
|
|
615
|
+
mocha_1.test,
|
|
616
|
+
__metadata("design:type", Function),
|
|
617
|
+
__metadata("design:paramtypes", []),
|
|
618
|
+
__metadata("design:returntype", Promise)
|
|
619
|
+
], QueryTest.prototype, "subSelectWhereInWithDirectQuery", null);
|
|
620
|
+
QueryTest = __decorate([
|
|
621
|
+
mocha_1.suite
|
|
622
|
+
], QueryTest);
|
|
623
623
|
//# sourceMappingURL=QueryTest.js.map
|