【发布时间】:2021-03-23 03:01:54
【问题描述】:
我尝试了许多不同的方法来使用 simple-json 作为实体上的整数类型。
@ObjectType()
@Entity()
export default class PlayerEntity extends BaseEntity {
@Field(() => Int)
@PrimaryGeneratedColumn()
id: number;
@Column()
@Field()
username: string;
@Column({ type: "simple-json" })
@Field()
info: Info;
}
Info 看起来像
@InputType()
@ObjectType()
export default class Info {
@Field()
address: string;
@Field(() => Int)
house_number: number;
}
【问题讨论】:
-
"自定义 json 标量" ... graphql-type-json ?
标签: node.js typescript express graphql typegraphql