V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
TangMonk
V2EX  ›  Node.js

typeorm 有人用吗?

  •  
  •   TangMonk · 2017-02-23 09:40:22 +08:00 · 2977 次点击
    这是一个创建于 2628 天前的主题,其中的信息可能已经有所发展或是发生改变。

    可以这样定义 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 条回复    2017-02-23 12:48:06 +08:00
    xiamx
        1
    xiamx  
       2017-02-23 11:57:11 +08:00   ❤️ 1
    嗯 TypeORM 用了 TypeScript 的 design-time type reflection 。这个功能用在 ORM 上真是非常的恰当。

    另外推广一下一个非 ORM 作品 https://github.com/SweetIQ/schemats
    TangMonk
        2
    TangMonk  
    OP
       2017-02-23 12:48:06 +08:00
    @xiamx 我还不敢用,怕入坑。。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   731 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 21:01 · PVG 05:01 · LAX 14:01 · JFK 17:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.