V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
爱意满满的作品展示区。
bigpigeon

一个 go 的 orm

  •  
  •   bigpigeon · Mar 1, 2018 · 3781 views
    This topic created in 2982 days ago, the information mentioned may be changed or developed.

    https://github.com/bigpigeon/toyorm

    主要是支持通过 Offsetof 选择字段(目前 go 的 orm 匹配字段都很别扭)

    支持 mysql 和 sqlite3 数据库,过段时间会加入 postgresql 目前还在 alpha 阶段:往后我会加入 CAS 和 collection 等几个有趣的 feature

    希望大家多多支持

    6 replies    2018-05-17 16:21:28 +08:00
    wfhtqp
        1
    wfhtqp  
       Mar 2, 2018
    关联关系呢? json 支持呢?
    bigpigeon
        2
    bigpigeon  
    OP
       Mar 2, 2018
    https://github.com/bigpigeon/toyorm#type-translate
    @wfhtqp 关联关系已经加了

    json 支持是啥意思
    wfhtqp
        3
    wfhtqp  
       Mar 3, 2018
    @bigpigeon 您不是准备加入 postgresql ?那对 postgresql 的 json 的支持呢?
    bigpigeon
        4
    bigpigeon  
    OP
       Mar 4, 2018
    @wfhtqp json 子查询和 go 的 struct 不是很契合,不过可以通过把 cloumn 定义为子查询字段名的方式实现
    tysx
        5
    tysx  
       May 17, 2018
    性能怎么样?和 gorm 相比有什么优势?
    bigpigeon
        6
    bigpigeon  
    OP
       May 17, 2018
    @tysx benchmark 还没写,应该不会比 gorm 差,比 gorm 多一个 join 功能,而且 preload 的用法比它好一点,而且支持 unsafe.Offsetof 这种 field selec 的方法
    我之前也是用 gorm 的,我看他的实现不咋好所以自己撸了一个,不过现在 gorm 强在他有一个强大的 qor,用来搭建 admin 管理平台和一键式网站很方便
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2513 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 41ms · UTC 06:09 · PVG 14:09 · LAX 23:09 · JFK 02:09
    ♥ Do have faith in what you're doing.