How to perform a like query Typeorm

后端 未结 5 491
北海茫月
北海茫月 2020-12-30 22:40

Hello guys I\'m trying to find all the results that have a in them. I have tried a couple of ways but the problem is nothing works. It just returns an empty array

5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-30 23:07

    You can also use the database function for concatenation. In postgres for instance:

     var data = await getRepository(User)
                  .createQueryBuilder("user")
                  .where("user.firstName like '%' || :name || '%'", {name: firstName })
                  .getMany();
    

提交回复
热议问题