TypeORM-readme-19.ts
· 365 B · TypeScript
原始檔案
import { Entity, Column, PrimaryGeneratedColumn } from "typeorm"
@Entity()
export class Photo {
@PrimaryGeneratedColumn()
id: number
@Column({
length: 100,
})
name: string
@Column("text")
description: string
@Column()
filename: string
@Column("double")
views: number
@Column()
isPublished: boolean
}
1 | import { Entity, Column, PrimaryGeneratedColumn } from "typeorm" |
2 | |
3 | @Entity() |
4 | export class Photo { |
5 | @PrimaryGeneratedColumn() |
6 | id: number |
7 | |
8 | @Column({ |
9 | length: 100, |
10 | }) |
11 | name: string |
12 | |
13 | @Column("text") |
14 | description: string |
15 | |
16 | @Column() |
17 | filename: string |
18 | |
19 | @Column("double") |
20 | views: number |
21 | |
22 | @Column() |
23 | isPublished: boolean |
24 | } |