update.ts
1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { Model, fn, col, literal } from 'sequelize';
import { User } from './models/User';
class TestModel extends Model {
}
TestModel.update({}, { where: {} });
TestModel.update({}, { where: {}, returning: false });
TestModel.update({}, { where: {}, returning: true });
TestModel.update({}, { where: {}, returning: ['foo'] });
User.update({}, { where: {} });
User.update({
id: 123,
username: fn('FN'),
firstName: col('id'),
lastName: literal('Smith'),
}, { where: {} });
User.update({}, { where: {}, returning: true });
User.update({}, { where: {}, returning: false });
User.update({}, { where: {}, returning: ['username'] });
User.build().update({
id: 123,
username: fn('FN'),
firstName: col('id'),
lastName: literal('Smith'),
});
// @ts-expect-error invalid `returning`
User.update({}, { where: {}, returning: ['foo'] });
// @ts-expect-error no `where`
User.update({}, {});
// @ts-expect-error invalid attribute
User.update({ foo: '<bar>' }, { where: {} });
// @ts-expect-error invalid attribute
User.build().update({ foo: '<bar>' });