相关文章推荐
风流的手术刀  ·  ASP.NETCore ...·  2 年前    · 
失恋的白开水  ·  JS截取字符串 ...·  2 年前    · 

typeorm 批量更新

要进行批量更新,可以使用set方法进行更新,在使用orm函数时,始终建议不要使用原始查询。

import {getConnection, In} from "typeorm";
const userIds = [1,2,3];
await getConnection()
  .createQueryBuilder()
  .update(User)
  .set({ isaSeniorCitizen: true })
  .where({ id: In(userIds) })
  .execute();
        TripleW
        NestJS