Typescript 如何使用psql在TypeForm中存储对象列表
我想用TypeForm存储对象列表。。 我的界面是这样的Typescript 如何使用psql在TypeForm中存储对象列表,typescript,postgresql,nestjs,psql,typeorm,Typescript,Postgresql,Nestjs,Psql,Typeorm,我想用TypeForm存储对象列表。。 我的界面是这样的 interface Comments { blogId:number, writtenBy:string, submittedAt:Date } 我想把它存储在TypeForm的数组中 @Column({type:'<Comments>',array: true,default:"{}"}) comments:Comments[] @列({type:'',数组:true,默认值:{})
interface Comments {
blogId:number,
writtenBy:string,
submittedAt:Date
}
我想把它存储在TypeForm的数组中
@Column({type:'<Comments>',array: true,default:"{}"})
comments:Comments[]
@列({type:'',数组:true,默认值:{})
评论:评论[]
我如何才能做到这一点?我通过将注释列设置为字符串/文本并使用JSON.parse和JSON.stringify来检索答案来解决这个问题
@Column({type: 'jsonb', array: true, nullable: true})
testArray2: object[];