Skip to content
This repository was archived by the owner on Mar 18, 2022. It is now read-only.

Commit 2478198

Browse files
xiaojianzhongpleerock
authored andcommitted
docs: remove duplicate segment in entities.md (typeorm#4638)
Remove duplicate segment.
1 parent 5bd29d5 commit 2478198

1 file changed

Lines changed: 0 additions & 43 deletions

File tree

docs/zh_CN/entities.md

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -346,49 +346,6 @@ export class User {
346346
}
347347
```
348348

349-
### `simple-array` column type
350-
351-
`postgres``mysql`支持`enum`列类型。 有多种列定义方式:
352-
353-
使用 typescript 枚举:
354-
355-
```typescript
356-
export enum UserRole {
357-
ADMIN = "admin",
358-
EDITOR = "editor"
359-
GHOST = "ghost"
360-
}
361-
@Entity()
362-
export class User {
363-
@PrimaryGeneratedColumn()
364-
id: number;
365-
@Column({
366-
type: "enum",
367-
enum: UserRole,
368-
default: UserRole.GHOST
369-
})
370-
role: UserRole
371-
}
372-
```
373-
374-
> 注意:支持字符串,数字和异构枚举。
375-
> 使用带枚举值的数组:
376-
377-
```typescript
378-
export type UserRoleType = "admin" | "editor" | "ghost",
379-
@Entity()
380-
export class User {
381-
@PrimaryGeneratedColumn()
382-
id: number;
383-
@Column({
384-
type: "enum",
385-
enum: ["admin", "editor", "ghost"],
386-
default: "ghost"
387-
})
388-
role: UserRoleType
389-
}
390-
```
391-
392349
### `simple-array`的列类型
393350

394351
有一种称为`simple-array`的特殊列类型,它可以将原始数组值存储在单个字符串列中。

0 commit comments

Comments
 (0)