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

Share a golang orm library with golang style syntax

藏色散人
Release: 2021-02-08 16:09:59
forward
2019 people have browsed it

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"),
)
Copy after login

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!

Related labels:
source:segmentfault.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template