How to perform a like query Typeorm

后端 未结 5 649
北海茫月
北海茫月 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:20

    var data = await  getRepository(User)
                            .createQueryBuilder("user")
                            .where("user.firstName ILIKE %q, {q:`%${VALUE_HERE}%` })
                    .getMany();
    

    This is how I do it. Hope it helps

提交回复
热议问题