TangMonk
V2EX  ›  Node.js

typeorm 有人用吗?

  •  
  •   TangMonk · Feb 23, 2017 · 3533 views
    This topic created in 3395 days ago, the information mentioned may be changed or developed.

    可以这样定义 Model:

    import {Entity, Column, PrimaryColumn} from "typeorm";
    
    @Entity()
    export class Photo {
    
        @PrimaryColumn()
        id: number;
    
        @Column()
        name: string;
    
        @Column()
        description: string;
    
        @Column()
        fileName: string;
    
        @Column()
        views: number;
    
        @Column()
        isPublished: boolean;
    }
    

    感觉比 sequelize 好用啊

    2 replies    2017-02-23 12:48:06 +08:00
    xiamx
        1
    xiamx  
       Feb 23, 2017   ❤️ 1
    嗯 TypeORM 用了 TypeScript 的 design-time type reflection 。这个功能用在 ORM 上真是非常的恰当。

    另外推广一下一个非 ORM 作品 https://github.com/SweetIQ/schemats
    TangMonk
        2
    TangMonk  
    OP
       Feb 23, 2017
    @xiamx 我还不敢用,怕入坑。。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   4281 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 52ms · UTC 05:20 · PVG 13:20 · LAX 22:20 · JFK 01:20
    ♥ Do have faith in what you're doing.