!
在 JS 对象的键声明中,冒号前的语法是什么?
类的 MikroORM 语法
@Entity()
export class Post {
// the @PrimaryKey invokes a function that takes the returned key/value pair and adds it as a column / information
@PrimaryKey()
id!: number;
@Property({ type: "date", default: "NOW()" })
createdAt = new Date();
@Property({ type: "date", default: "NOW()", onUpdate: () => new Date() })
updatedAt = new Date();
@Property({ type: "text" })
title!: string;
}