golang-database-library-orm-example
Examples of using various popular database libraries and ORM in Go. (by gmhafiz)
GORM
The fantastic ORM library for Golang, aims to be developer friendly (by go-gorm)
Our great sponsors
golang-database-library-orm-example | GORM | |
---|---|---|
4 | 74 | |
21 | 35,481 | |
- | 1.7% | |
0.0 | 8.5 | |
about 1 year ago | about 17 hours ago | |
Go | Go | |
- | 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.
golang-database-library-orm-example
Posts with mentions or reviews of golang-database-library-orm-example.
We have used some of these posts to build our list of alternatives
and similar projects. The last one was on 2022-12-12.
-
Golang Database Library and Orm Examples
What I found is sqlx and sqlc are excellent for hand-rolled queries, but is poor for dynamic queries which a query builder library/orm might suite better. If there are many eager-loading table relationships, I found that orms tend to be much better. Of course these are entirely my personal opinion. I dove into more details on how each libraries and orms fares against those operations in the posts. It is also accompanied with reproducible repo at https://github.com/gmhafiz/golang-database-library-orm-example
-
Dynamic sql code during runtime.
I discussed approaches using different libraries and ORMs at https://www.gmhafiz.com/blog/golang-database-library-orm-example-dynamic-list/. Though I just realised the example for squirrel is missing. Check out the code examples though
-
Scanning joined SQL rows into nested go struct
I show scans for a many to many relationship between two tables. https://github.com/gmhafiz/golang-database-library-orm-example/blob/master/db/sqlc/manyToMany.go
-
What kind of things have you ran with go:generate?
I made repo that compares between different libraries and orms including sqlx, sqlc, sqlboiler, gorm, and ent https://github.com/gmhafiz/golang-database-library-orm-example
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 2024-01-18.
-
Go ORMs Compared
GORM is a comprehensive ORM tool in Go, offering a code-first approach which allows defining database schemas using struct tags in Go. It's known for its developer-friendly nature, making it suitable for both beginners and experienced users. GORM supports a variety of SQL databases like MySQL, PostgreSQL, and SQLite. It's designed to be flexible, allowing developers to drop down to raw SQL when necessary. However, it's important to be cautious about its performance implications in large-scale applications.
-
6 🔥 Awesome Golang packages (web devs)
Homepage: https://gorm.io/
- Tenha controle sobre seu SQL com Golang e SQLC
- Não use funções puras com Go
-
Build an Event-Driven Uptime Monitor in Go 🚀
Since most of these APIs will be simple CRUD (Create/Read/Update/Delete) endpoints, let's build this service using GORM, an ORM library that makes building CRUD endpoints really simple.
- [OpenSource] I am building high performance Plex alternative in Go for Movies and TV Show
-
Building Robust Applications in Go: Integrating Envconfig, Gorm, and OpenSearch
After successfully configuring the application, it's time to delve into integrating the data layer. For this purpose, I will utilize gorm, a powerful SQL ORM that facilitates rapid development of the data layer using model structs.
-
ORM or no ORM that is the question
For basic INSERT ... VALUES ... or SELECT ... WHERE ... JOIN ..., use a library such as GORM. For INSERT .... SELECT ... statements where one combines two round trips (SELECT and INSERT) into one, ORMs have a hard time performing this query. Particularly when you start doing joins. Joins are the heart of Relational database theory (they denote relationships). So get to know what an INNER, LEFT, RIGHT and OUTER join is and why you would use them. Also learn INSERT ... SELECT ...
-
Why ORMs are so hated?
I have never hated gorm and it serves me well. However I tend to feed it raw SQL very often.
-
Golang RESTAPI boilerplate repository
Array of values with embedded value all pointed to the last value, reflect code was broken: https://github.com/go-gorm/gorm/pull/5901 data corruption
What are some alternatives?
When comparing golang-database-library-orm-example and GORM you can also consider the following projects:
bob - SQL query builder and ORM/Factory generator for Go with support for PostgreSQL, MySQL and SQLite
ent - An entity framework for Go
optional - Optional is a library of optional Go types
Xorm
SQLBoiler - Generate a Go ORM tailored to your database schema.
gorm-seeder - Gorm seeder package
go-pg - Golang ORM with focus on PostgreSQL features and performance
sqlc - Generate type-safe code from SQL
pgx - PostgreSQL driver and toolkit for Go
jwt-auth-api - JWT Authentication Implementation in Golang
beego orm
golang-database-library-orm-example vs bob
GORM vs ent
golang-database-library-orm-example vs optional
GORM vs Xorm
golang-database-library-orm-example vs ent
GORM vs SQLBoiler
golang-database-library-orm-example vs gorm-seeder
GORM vs go-pg
golang-database-library-orm-example vs sqlc
GORM vs pgx
golang-database-library-orm-example vs jwt-auth-api
GORM vs beego orm