Does golang require ORM?

(*-*)浩
Release: 2019-12-31 10:07:05
Original
4756 people have browsed it

Does golang require ORM?

The currently more mainstream/active ORMs include gorm, xorm, gorose, etc.                               (Recommended learning: go)

xorm

## Supported databases are: mysql, mymysql, postgres, tidb, sqlite, mssql, oracle

Transactional support

Chain api

has, err := engine.Where("name = ?", name).Desc("id").Get(&user)
err := engine.Where(builder.NotIn("a", 1, 2).And(builder.In("b", "c", "d", "e"))).Find(&users)
Copy after login

Support native sql operation

Query cache

Can be based on Database reverse generation code

Cascading loading

Provide sql statement log output

Support batch query processing

gorm

hook mechanism (Before/After Create/Save/Update/Delete/Find)

Object relationship Has One, Has Many, Belongs To, Many To Many, Polymorphism

Hot loading

Support native sql operations

Transactional

Chain api

tx := db.Where("name = ?", "jinzhu").Where("age = ?", 20).Find(&users)
Copy after login

Supported databases are: mysql, postgre, sqlite, sqlserver

Query operation

gorose

Supported databases are: mysql, postgres, sqlite, mssql, oracle

Chain api

Connect multiple databases and switch simultaneously

Support native sql operations

Support batch query processing

Transactional

similarity

The databases supported by each ORM are basically the same (all mainstream databases support it)

Support transactional, chained queries, etc.

Differences

xorm and gorose support batch query processing

xorm supports master-slave read and write separation

gorm supports hot loading

gorose facilitates switching between multiple databases

Comprehensive documentation gorm>xorm>gorose

The above is the detailed content of Does golang require ORM?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!