some.entity.ts
amount:number
但是当我在postgres中存储非常大的数据时,它将引发错误“''整数超出范围”''
我的问题是如何使用typeorm将 Big Int 存储为psql中的类型
答案 0 :(得分:1)
在@Column装饰器中定义类型bigint
,
@Column({type: 'bigint'})
columnName: number;
答案 1 :(得分:0)
在TypeORM的配置中加入{ bigNumberStrings: false }
即可,如:
TypeOrmModule.forRoot({
bigNumberStrings: false,
...config.database,
}),
那么 bigint 将返回数字类型。