Use Not(IsNull())
This commit is contained in:
syuilo 2019-05-20 21:44:16 +09:00
parent 5a3ea38bbf
commit e7dd5e155d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
7 changed files with 27 additions and 13 deletions

View file

@ -128,6 +128,20 @@ query.andWhere(new Brackets(qb => {
}));
```
### Not `null` in TypeORM
```ts
const foo = await Foos.findOne({
bar: Not(null)
});
```
のようなクエリ(`bar``null`ではない)は期待通りに動作しない。
次のようにします:
```ts
const foo = await Foos.findOne({
bar: Not(IsNull())
});
```
### `null` in SQL
SQLを発行する際、パラメータが`null`になる可能性のある場合はSQL文を出し分けなければならない
例えば