typeormファジイクエリ
516 ワード
公式サイトのドキュメントには詳細な説明がありませんので、ここで簡単なドキュメントを記録します.
次のようになります.
次のようになります.
async fuzzySearch(name: string){
const postRepository = connection.getRepository(Post);
return await postRepository.createQueryBuilder("post")
.where("post.title LIKE :param")
.setParameters({
param: '%'+name+'%'
})
.orderBy("post.id", "ASC")
.getMany();
}