[Awesome Go] Use GORM package to make developer-friendly database ORM
GORM
The fantastic ORM library for Golang aims to be developer friendly.
Overview
-
Full-Featured ORM
-
Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism, Single-table inheritance)
-
Hooks (Before/After Create/Save/Update/Delete/Find)
-
Eager loading with Preload, Joins
-
Transactions, Nested Transactions, Save Point, RollbackTo to Saved Point
-
Context, Prepared Statement Mode, DryRun Mode
-
Batch Insert, FindInBatches, Find/Create with Map, CRUD with SQL Expr and Context Valuer
-
SQL Builder, Upsert, Locking, Optimizer/Index/Comment Hints, Named Argument, SubQuery
-
Composite Primary Key, Indexes, Constraints
-
Auto Migrations
-
Logger
-
Extendable, flexible plugin API: Database Resolver (Multiple Databases, Read/Write Splitting) / Prometheus…
-
Every feature comes with tests
-
Developer Friendly
Installation
1 | go get -u gorm.io/gorm |
Quick Start
1 | package main |
References
[2] GORM - The fantastic ORM library for Golang, aims to be developer friendly. - https://gorm.io/