forked from mirror/gorm
380cc64ff5
* fix type alias AutoMigrate bug. eg ```go package main type IDer interface{ GetID() int64 } // ID will add some method to implement some interface eg: GetID type ID int64 func (z ID) GetID() int64 { return int64(z) } type Test struct { ID Code string `gorm:"size:50"` Name string `gorm:"size:50"` } func main() { db, err := gorm.Open(postgres.New(postgres.Config{ DSN: `dsn`, PreferSimpleProtocol: false, }), &gorm.Config{ Logger: logger.Default.LogMode(logger.Info), SkipDefaultTransaction: true, }) if err != nil { log.Fatal(err) } if err = db.AutoMigrate(&Test{}); err != nil { // invalid embedded struct for Test's field ID, should be struct, but got main.ID log.Fatal(err) } } ``` * fix type alias AutoMigrate bug. eg ```go package main type IDer interface{ GetID() int64 } // ID will add some method to implement some interface eg: GetID type ID int64 func (z ID) GetID() int64 { return int64(z) } type Test struct { ID Code string `gorm:"size:50"` Name string `gorm:"size:50"` } func main() { db, err := gorm.Open(postgres.New(postgres.Config{ DSN: `dsn`, PreferSimpleProtocol: false, }), &gorm.Config{ Logger: logger.Default.LogMode(logger.Info), SkipDefaultTransaction: true, }) if err != nil { log.Fatal(err) } if err = db.AutoMigrate(&Test{}); err != nil { // invalid embedded struct for Test's field ID, should be struct, but got main.ID log.Fatal(err) } } ``` * Add typealis test. * try to fix golangci-lint |
||
---|---|---|
.github | ||
callbacks | ||
clause | ||
logger | ||
migrator | ||
schema | ||
tests | ||
utils | ||
.gitignore | ||
.golangci.yml | ||
License | ||
README.md | ||
association.go | ||
callbacks.go | ||
chainable_api.go | ||
errors.go | ||
finisher_api.go | ||
go.mod | ||
go.sum | ||
gorm.go | ||
interfaces.go | ||
migrator.go | ||
model.go | ||
prepare_stmt.go | ||
scan.go | ||
soft_delete.go | ||
statement.go | ||
statement_test.go |
README.md
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 To Map
- SQL Builder, Upsert, Locking, Optimizer/Index/Comment Hints, NamedArg, Search/Update/Create with SQL Expr
- Composite Primary Key
- Auto Migrations
- Logger
- Extendable, flexible plugin API: Database Resolver (Multiple Databases, Read/Write Splitting) / Prometheus…
- Every feature comes with tests
- Developer Friendly
Getting Started
- GORM Guides https://gorm.io
Contributing
You can help to deliver a better GORM, check out things you can do
License
© Jinzhu, 2013~time.Now
Released under the MIT License