我有一个带有@PrimaryGeneeratedColumn('uuid')
的表。
当我尝试使用 TypeORM 查询生成器查询它时,出现错误
QueryFailedError: invalid input syntax for type uuid: "{"id":"8f294654-8385-4579-a714-0fae73839430"}"
查询是
this.repository.createQueryBuilder('products')
.leftJoinAndSelect('products.brand', 'brands')
.leftJoinAndSelect('products.category', 'categories')
.leftJoinAndSelect('products.productOptions', 'productOptions')
.where('products.id = :id', { id })
.getOne()
有没有办法将字符串 uuid 转换为 postgresql uuid?
最佳答案
看起来 id
正在期待 "8f294654-8385-4579-a714-0fae73839430"
但不知何故你传递了 {"id":"的对象8f294654-8385-4579-a714-0fae73839430"}
。
关于postgresql - TypeORM 查询生成器查找 id 等于 PostgreSQL UUID 的位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68047134/