简体   繁体   English

我可以按 TypeORM/PostgreSQL 中的加密列对结果进行排序吗?

[英]Can I sort results by encrypted column in TypeORM/PostgreSQL?

I'm coding with NestJS using TypeORM and PostgreSQL database.我正在使用 TypeORM 和 PostgreSQL 数据库使用 NestJS 进行编码。 I created an entity with a transformer in order to store encrypted data.我创建了一个带有transformer的实体以存储加密数据。 Am I able to somehow sort the results by the encrypted column on database side?我是否能够以某种方式通过数据库端的加密列对结果进行排序?

Let's say I have an encrypted name column.假设我有一个加密的name列。 repository.find({ order: { name: 'ASC' } }) doesn't sort the results by name. repository.find({ order: { name: 'ASC' } })不会按名称对结果进行排序。 I suppose that the results are sorted by encrypted name.我想结果是按加密名称排序的。

That is fundamentally impossible.这是根本不可能的。 To sort, you need to know the clear text, which the database doesn't.要排序,您需要知道明文,而数据库不知道。

Security has a negative impact on usability and performance, that is unavoidable.安全性对可用性和性能有负面影响,这是不可避免的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM