Home >Backend Development >Golang >Share a golang orm library with golang style syntax

Share a golang orm library with golang style syntax

藏色散人
藏色散人forward
2021-02-08 16:09:472021browse

Share a golang orm library with golang style syntax

A golang orm library with golang style syntax

Recently open sourced gosql, a golang style Grammatical golang orm library.

Elegant syntax, supports batch insertion, easily nested conditions, handles various complex query SQL, such as: and and or combination
Full syntax support: for update lock, is null, exists subquery, etc. Basically all sql syntax

The style is as follows:

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"),
)

Features

  • Golang-style SQL builder go language style sql generation
  • Unlimited nesting query Unlimited nesting of query conditions
  • Reading and Writing Separation
  • Delay connection creation Delayed connection creation
  • ORM mapping to sturct ORM mapping structure Body
  • Transactions Support
  • Versatile Multifunctional
  • Clean Code Simple code
  • Bulk Insert Support batch insertion

Warehouse address:

https://github.com/rushteam/gosql

The above is the detailed content of Share a golang orm library with golang style syntax. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:segmentfault.com. If there is any infringement, please contact admin@php.cn delete