From 1fb623dfbba585fd0c22473d13b1bfdb54d382ca Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 13 Feb 2018 17:59:29 +0800 Subject: [PATCH 1/4] Update README --- README.md | 31 ++++++++++--------------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 6ff49b87..7a861f39 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,12 @@ The fantastic ORM library for Golang, aims to be developer friendly. -[![Join the chat at https://gitter.im/jinzhu/gorm](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/jinzhu/gorm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![go report card](https://goreportcard.com/badge/github.com/jinzhu/gorm "go report card")](https://goreportcard.com/report/github.com/jinzhu/gorm) [![wercker status](https://app.wercker.com/status/8596cace912c9947dd9c8542ecc8cb8b/s/master "wercker status")](https://app.wercker.com/project/byKey/8596cace912c9947dd9c8542ecc8cb8b) +[![Join the chat at https://gitter.im/jinzhu/gorm](https://img.shields.io/gitter/room/jinzhu/gorm.svg)](https://gitter.im/jinzhu/gorm?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Open Collective Backer](https://opencollective.com/gorm/tiers/backer/badge.svg?label=backer&color=brightgreen "Open Collective Backer")](https://opencollective.com/gorm) +[![Open Collective Sponsor](https://opencollective.com/gorm/tiers/sponsor/badge.svg?label=sponsor&color=brightgreen "Open Collective Sponsor")](https://opencollective.com/gorm) +[![MIT license](http://img.shields.io/badge/license-MIT-brightgreen.svg)](http://opensource.org/licenses/MIT) [![GoDoc](https://godoc.org/github.com/jinzhu/gorm?status.svg)](https://godoc.org/github.com/jinzhu/gorm) ## Overview @@ -24,28 +27,14 @@ The fantastic ORM library for Golang, aims to be developer friendly. ## Getting Started -* GORM Guides [jinzhu.github.com/gorm](https://jinzhu.github.io/gorm) +* GORM Guides [http://gorm.io](http://gorm.io) -## Upgrading To V1.0 +## Contributing -* [CHANGELOG](https://jinzhu.github.io/gorm/changelog.html) - -## Supporting the project - -[![http://patreon.com/jinzhu](https://c5.patreon.com/external/logo/become_a_patron_button.png)](http://patreon.com/jinzhu) - -## Author - -**jinzhu** - -* -* -* - -## Contributors - -https://github.com/jinzhu/gorm/graphs/contributors +[Become a backer or sponsor on Open Collective](http://opencollective.com/gorm) +[Become a backer or sponsor on Patreon](http://patreon.com/jinzhu) ## License -Released under the [MIT License](https://github.com/jinzhu/gorm/blob/master/License). +© 2013~`time.Now()`, Jinzhu +Released under the [MIT License](https://github.com/jinzhu/gorm/blob/master/License) From 6e1387b44c64dce50b89c2f56ed425f5f73e417c Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Tue, 13 Feb 2018 18:12:09 +0800 Subject: [PATCH 2/4] Update README --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7a861f39..caebbcfb 100644 --- a/README.md +++ b/README.md @@ -32,9 +32,11 @@ The fantastic ORM library for Golang, aims to be developer friendly. ## Contributing [Become a backer or sponsor on Open Collective](http://opencollective.com/gorm) + [Become a backer or sponsor on Patreon](http://patreon.com/jinzhu) ## License -© 2013~`time.Now()`, Jinzhu +© Jinzhu, 2013~time.Now + Released under the [MIT License](https://github.com/jinzhu/gorm/blob/master/License) From 55945afb346c0ca3e62f9cb44d73ff62bc2cce2e Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sat, 17 Feb 2018 00:33:52 +0800 Subject: [PATCH 3/4] Update README --- README.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index caebbcfb..0c5c7ea6 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ The fantastic ORM library for Golang, aims to be developer friendly. * Full-Featured ORM (almost) * Associations (Has One, Has Many, Belongs To, Many To Many, Polymorphism) -* Callbacks (Before/After Create/Save/Update/Delete/Find) +* Hooks (Before/After Create/Save/Update/Delete/Find) * Preloading (eager loading) * Transactions * Composite Primary Key @@ -31,9 +31,7 @@ The fantastic ORM library for Golang, aims to be developer friendly. ## Contributing -[Become a backer or sponsor on Open Collective](http://opencollective.com/gorm) - -[Become a backer or sponsor on Patreon](http://patreon.com/jinzhu) +[You can help to deliver a better GORM, check out things you can do](http://gorm.io/contribute.html) ## License From 58e34726dfc069b558038efbaa25555f182d1f7a Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Sun, 18 Feb 2018 09:00:03 +0800 Subject: [PATCH 4/4] Don't access scanner's fields if already defined data type --- dialect.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/dialect.go b/dialect.go index b20bfd5b..5f6439c1 100644 --- a/dialect.go +++ b/dialect.go @@ -94,14 +94,16 @@ var ParseFieldStructForDialect = func(field *StructField, dialect Dialect) (fiel } // Get scanner's real value - var getScannerValue func(reflect.Value) - getScannerValue = func(value reflect.Value) { - fieldValue = value - if _, isScanner := reflect.New(fieldValue.Type()).Interface().(sql.Scanner); isScanner && fieldValue.Kind() == reflect.Struct { - getScannerValue(fieldValue.Field(0)) + if dataType == "" { + var getScannerValue func(reflect.Value) + getScannerValue = func(value reflect.Value) { + fieldValue = value + if _, isScanner := reflect.New(fieldValue.Type()).Interface().(sql.Scanner); isScanner && fieldValue.Kind() == reflect.Struct { + getScannerValue(fieldValue.Field(0)) + } } + getScannerValue(fieldValue) } - getScannerValue(fieldValue) // Default Size if num, ok := field.TagSettings["SIZE"]; ok {