📜  typeorm enum postgres - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:49.345000             🧑  作者: Mango

代码示例1
export enum UserRole {
    ADMIN = "admin",
    EDITOR = "editor",
    GHOST = "ghost"
}

@Entity()
export class User {

    @PrimaryGeneratedColumn()
    id: number;

    @Column({
        type: "enum",
        enum: UserRole,
        default: UserRole.GHOST
    })
    role: UserRole;

}