reform
A better ORM for Go, based on non-empty interfaces and code generation. (by go-reform)
GORM
The fantastic ORM library for Golang, aims to be developer friendly (by go-gorm)
Our great sponsors
reform | GORM | |
---|---|---|
1 | 39 | |
1,251 | 28,056 | |
1.5% | 2.6% | |
4.8 | 9.3 | |
24 days ago | 6 days ago | |
Go | Go | |
MIT License | MIT License |
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
reform
Posts with mentions or reviews of reform.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-01-29.
-
[Question] Working with databases/storing data in Go applications.
However, you can use something like this https://github.com/go-reform/reform to help you with, I will call it automating the code writing. But I have always opted to one of the supported drivers and written a queries myself using for example this https://github.com/go-sql-driver/mysql.
GORM
Posts with mentions or reviews of GORM.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-05-14.
-
Go Echo API Server Development
db operation from apps by gorm
-
Alternative to MongoDB?
If you want some "developer experience", look at https://gorm.io/
- Python/Django to Golang questions
-
Multitenant application with golang and gorm
"gorm.io/driver/postgres" "gorm.io/gorm" gocache "zgo.at/zcache" ) var cacheHandler *gocache.Cache type StoreDB struct { CreationMutex sync.Mutex cache *gocache.Cache } type Context struct { Schema string } func (s *StoreDB) CreateDBHandler(ctx *Context) *gorm.DB { // Maybe we could use a better mechanism to do this. s.CreationMutex.Lock() defer s.CreationMutex.Unlock() // Double check before moving to Creation precedures if db, found := s.cache.Touch(ctx.Schema, gocache.DefaultExpiration); found { return db.(*gorm.DB) } dsn := fmt.Sprintf("host=%s user=%s password=%s dbname=%s sslmode=disable search_path=%s", getEnv("DB_HOST", "db"), getEnv("DB_USER", "postgres"), getEnv("DB_PASSWORD", "example"), getEnv("DB_NAME", "some-database"), ctx.Schema) db, err := gorm.Open(postgres.Open(dsn), &gorm.Config{}) if err != nil { panic(err) } cacheHandler.Set(ctx.Schema, db, gocache.DefaultExpiration) return db } func (s *StoreDB) GetDBHandler(ctx *Context) *gorm.DB { db, found := s.cache.Touch(ctx.Schema, gocache.DefaultExpiration) if found { return db.(*gorm.DB) } return s.CreateDBHandler(ctx) } func initManager() *StoreDB { cacheHandler = gocache.New(10*time.Minute, 10*time.Minute) cacheHandler.OnEvicted(func(s string, i interface{}) { // https://github.com/go-gorm/gorm/issues/3145 sql, err := i.(*gorm.DB).DB() if err != nil { panic(err) } sql.Close() }) return &StoreDB{ cache: cacheHandler, } }
-
The Power of Generics in Go: The Repository pattern for GORM
I agree with /u/in_the_cloud that in principle it would be nicer to push that all the way into GORM itself. Perhaps it's time for a major revision branch there. There is an issue discussing generics but it seems like the beginning of a beginning of a conversation about it. It'll definitely be some work; I can virtually guarantee several passes will be necessary before a 2.x release will be possible. If nothing else, there's the initial conversion which just propagates the generics around, and then a second pass when staring at the end result shows the new ways it can be used to simplify things.
-
Which database do you recommend to be used with Golang?
I use https://gorm.io with mariadb
- Most recommended database migration tool? using golang for the record
- Any Tips for Go Newcomer?
- Looking for some ORM/db access layer suggestions
- Golang Oracle DB Example
What are some alternatives?
When comparing reform and GORM you can also consider the following projects:
ent - An entity framework for Go
Xorm
SQLBoiler - Generate a Go ORM tailored to your database schema.
go-pg - Golang ORM with focus on PostgreSQL features and performance
beego orm
gorp - Go Relational Persistence - an ORM-ish library for Go
xorm - xorm是一个简单而强大的Go语言ORM库,通过它可以使数据库操作非常简便。本库是基于原版xorm的定制增强版本,为xorm提供类似ibatis的配置文件及动态SQL支持,支持AcitveRecord操作
pgx - PostgreSQL driver and toolkit for Go
upper.io/db - Data access layer for PostgreSQL, CockroachDB, MySQL, SQLite and MongoDB with ORM-like features.
sqlc - Generate type-safe code from SQL
pop/soda - A Tasty Treat For All Your Database Needs
Squirrel - Fluent SQL generation for golang