TypeORM - metadata

오픈소스·2023년 6월 21일
0
  @Entity('user')
  @Unique(['email'])
  class UserEntity {
    @PrimaryColumn({ type: 'uuid' })
    id: string;

    @CreateDateColumn()
    created_at: Date;

    @UpdateDateColumn()
    updated_at: Date;

    @Column({ type: 'varchar', length: 64, comment: '이메일 주소' })
    email: string;
  }

위와 같이 선언 했을 때,

https://github.com/typeorm/typeorm/blob/master/src/globals.ts#L23
getMetadataArgsStorage()

{
  "tables": [
    {
      "name": "user",
      "type": "regular"
    }
  ],
  "trees": [],
  "entityRepositories": [],
  "transactionEntityManagers": [],
  "transactionRepositories": [],
  "namingStrategies": [],
  "entitySubscribers": [],
  "indices": [],
  "uniques": [
    {
      "columns": [
        "email"
      ]
    }
  ],
  "checks": [],
  "exclusions": [],
  "columns": [
    {
      "propertyName": "id",
      "mode": "regular",
      "options": {
        "type": "uuid",
        "primary": true
      }
    },
    {
      "propertyName": "created_at",
      "mode": "createDate",
      "options": {}
    },
    {
      "propertyName": "updated_at",
      "mode": "updateDate",
      "options": {}
    },
    {
      "propertyName": "email",
      "mode": "regular",
      "options": {
        "type": "varchar",
        "length": 64,
        "comment": "이메일 주소"
      }
    }
  ],
  "generations": [],
  "relations": [],
  "joinColumns": [],
  "joinTables": [],
  "entityListeners": [],
  "relationCounts": [],
  "relationIds": [],
  "embeddeds": [],
  "inheritances": [],
  "discriminatorValues": []
}

0개의 댓글