tspace-mysql 1.5.9 → 1.6.0
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 +5 -15
- package/build/lib/connection/options.js +1 -1
- package/build/lib/core/Model.d.ts +112 -106
- package/build/lib/core/Model.js +31 -9
- package/build/lib/core/Model.js.map +1 -1
- package/build/lib/core/Repository.d.ts +32 -1
- package/build/lib/core/Repository.js +42 -6
- package/build/lib/core/Repository.js.map +1 -1
- package/build/lib/types.d.ts +9 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -423,22 +423,13 @@ import { Operator } from 'tspace-mysql'
|
|
|
423
423
|
|
|
424
424
|
const whereObject = await new DB("users")
|
|
425
425
|
.whereObject({
|
|
426
|
-
id : Operator.
|
|
426
|
+
id : Operator.notEq(1),
|
|
427
427
|
username : Operator.in(['user1','user2']),
|
|
428
428
|
name : Operator.like('%value%')
|
|
429
429
|
})
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
// You can also use .where as well.
|
|
433
|
-
const where = await new DB("users")
|
|
434
|
-
.where({
|
|
435
|
-
id : 1,
|
|
436
|
-
username : 'username1',
|
|
437
|
-
name : Operator.like('%value%')
|
|
438
|
-
})
|
|
439
|
-
.findMany();
|
|
430
|
+
.findMany();
|
|
440
431
|
|
|
441
|
-
// SELECT * FROM `users` WHERE `users`.`id`
|
|
432
|
+
// SELECT * FROM `users` WHERE `users`.`id` <> '1' AND `users`.`username` = 'user1' AND `users`.`name` LIKE '%value%';
|
|
442
433
|
|
|
443
434
|
```
|
|
444
435
|
|
|
@@ -767,7 +758,6 @@ const user = await new DB("users")
|
|
|
767
758
|
},
|
|
768
759
|
},
|
|
769
760
|
])
|
|
770
|
-
.whereIn("id", [1, 2])
|
|
771
761
|
.save();
|
|
772
762
|
|
|
773
763
|
/**
|
|
@@ -2724,9 +2714,9 @@ const userHasPhones = await userRepository.findOne({
|
|
|
2724
2714
|
where : {
|
|
2725
2715
|
id: 1
|
|
2726
2716
|
},
|
|
2727
|
-
relations : ['
|
|
2717
|
+
relations : ['phone'],
|
|
2728
2718
|
relationQuery:{
|
|
2729
|
-
name : '
|
|
2719
|
+
name : 'phone',
|
|
2730
2720
|
callback: () : TRepository<Phone> => ({ // add type for the callback know to check type of the model
|
|
2731
2721
|
select: ['id', 'userId', 'name'],
|
|
2732
2722
|
relations : ['user']
|
|
@@ -28,7 +28,7 @@ const env = {
|
|
|
28
28
|
DATABASE: ENV.DB_DATABASE || ENV.TSPACE_DATABASE,
|
|
29
29
|
CONNECTION_LIMIT: ENV.DB_CONNECTION_LIMIT || ENV.TSPACE_CONNECTION_LIMIT || 30,
|
|
30
30
|
QUEUE_LIMIT: ENV.DB_QUEUE_LIMIT || ENV.TSPACE_QUEUE_LIMIT || 0,
|
|
31
|
-
TIMEOUT: ENV.DB_TIMEOUT || ENV.TSPACE_TIMEOUT || 1000 *
|
|
31
|
+
TIMEOUT: ENV.DB_TIMEOUT || ENV.TSPACE_TIMEOUT || 1000 * 10,
|
|
32
32
|
CHARSET: ENV.DB_CHARSET || ENV.TSPACE_CHARSET || 'utf8mb4',
|
|
33
33
|
CONNECTION_ERROR: ENV.DB_CONNECTION_ERROR || ENV.TSPACE_CONNECTION_ERROR || false,
|
|
34
34
|
WAIT_FOR_CONNECTIONS: ENV.DB_WAIT_FOR_CONNECTIONS || ENV.TSPACE_WAIT_FOR_CONNECTIONS || true,
|