一款golang style语法的golang orm库

浏览:488 发布日期:2020/05/21 分类:技术分享
最近开源了gosql 一款golang style语法的golang orm库.

优雅的语法,支持批量插入,轻松嵌套条件,处理各种复杂的查询sql,诸如: and 和or组合
全语法支持: for update锁,is null, exists 子查询等基本上所有sql语法

风格如下:user := &UserModel{}
err := db.Fetch(user, 
    gosql.Columns("id","name"),
    gosql.Where("id", 1),
    gosql.Where("[like]name", "j%")
    gosql.OrWhere(func(s *Clause) {
        s.Where("[>=]score", "90")
        s.Where("[<=]age", "100")
    }),
    GroupBy("type"),
    OrderBy("score DESC"),
)
特点

Golang-style SQL builder go语言风格sql生成
Unlimited nesting query 查询条件无限嵌套
Reading and Writing Separation 读写分离
Delay connection creation 延迟创建连接
ORM maping to sturct ORM映射结构体
Transactions 事务支持
Versatile 功能多样的
Clean Code 简洁的代码
Bulk Insert 支持批量插入

仓库地址:
https://github.com/rushteam/gosql
最佳答案
评论() 相关
后面还有条评论,点击查看>>