typescript - 传递 typeorm 实体作为参数来调用静态方法
问题描述
如何将 typeorm 实体作为参数传递给方法并在实体内执行静态方法?
我试图做这样的事情:
export const doSmthWithEntity = async <T extends BaseEntity>(entity: T, name: string, description: string = '') => {
const element = await entity.findOne({id: 1});
}
doSmthWithEntity(Customer, '','')
但它不起作用。有任何想法吗?
解决方案
推荐阅读
- go - 如何在 go 模板中排列数组的一部分?
- maven - 如何使用 mvn wildfly:run 命令部署两个项目
- angular2-template - NG0303:即使在导入 CommonModule 之后,也无法绑定到“ngIf”
- visual-studio-code - 在函数内部保留空行
- java - 关于包含类加载器的说明
- apache-kafka - ksqldb,问题设置模式注册表
- mysql - MySQL 基于列值运行总计
- google-cloud-platform - 使用 ansible 在 GCP 计算引擎上访问 vm 的外部 ip
- python - 在 Python 中:如何输入一个数字 x 并打印 x 次,每次增加 2
- android - 使用 RemoteView 删除 Widget 中以编程方式生成的布局