diff --git a/main.go b/main.go index a51144e5..22171e02 100644 --- a/main.go +++ b/main.go @@ -808,7 +808,7 @@ func (s *DB) EnableAfterScanCallback(typs ...interface{}) *DB { // Return if after scan callbacks has be enable. If typs is empty, return default, other else, return for informed // typs. -func (s *DB) EnabledAfterScanCallback(typs ...interface{}) (ok bool) { +func (s *DB) IsEnabledAfterScanCallback(typs ...interface{}) (ok bool) { key := "gorm:disable_after_scan" if v, ok := s.values[key]; ok { diff --git a/methodcallback.go b/methodcallback.go index 5f437b10..6046f50b 100644 --- a/methodcallback.go +++ b/methodcallback.go @@ -106,7 +106,7 @@ func (registrator *StructFieldMethodCallbacksRegistrator) DisableFieldType(typs } // Return if all callbacks for field type is enabled -func (registrator *StructFieldMethodCallbacksRegistrator) EnabledFieldType(typ interface{}) bool { +func (registrator *StructFieldMethodCallbacksRegistrator) IsEnabledFieldType(typ interface{}) bool { if enabled, ok := registrator.FieldTypes.Get(typ); ok { return enabled } diff --git a/methodcallback_test.go b/methodcallback_test.go index 6f417c89..ec30cf95 100644 --- a/methodcallback_test.go +++ b/methodcallback_test.go @@ -10,7 +10,7 @@ func init() { func ExampleStructFieldMethodCallbacksRegistrator_DisableFieldType() { fmt.Println(` -if registrator.EnabledFieldType(&Media{}) { +if registrator.IsEnabledFieldType(&Media{}) { registrator.DisableFieldType(&Media{}) } `) @@ -18,7 +18,7 @@ if registrator.EnabledFieldType(&Media{}) { func ExampleStructFieldMethodCallbacksRegistrator_EnabledFieldType() { fmt.Println(` -if !registrator.EnabledFieldType(&Media{}) { +if !registrator.IsEnabledFieldType(&Media{}) { println("not enabled") } `) @@ -26,7 +26,7 @@ if !registrator.EnabledFieldType(&Media{}) { func ExampleStructFieldMethodCallbacksRegistrator_EnableFieldType() { fmt.Println(` -if !registrator.EnabledFieldType(&Media{}) { +if !registrator.IsEnabledFieldType(&Media{}) { registrator.EnableFieldType(&Media{}) } `) diff --git a/scope.go b/scope.go index 008f28b1..e14400c2 100644 --- a/scope.go +++ b/scope.go @@ -476,11 +476,11 @@ func (scope *Scope) quoteIfPossible(str string) string { // call after field method callbacks func (scope *Scope) afterScanCallback(scannerFields map[int]*Field, disableScanField map[int]bool) { if !scope.HasError() && scope.Value != nil { - if scope.DB().EnabledAfterScanCallback(scope.Value) { + if scope.DB().IsEnabledAfterScanCallback(scope.Value) { scopeValue := reflect.ValueOf(scope) for index, field := range scannerFields { // if not is nill and if calbacks enabled for field type - if StructFieldMethodCallbacks.EnabledFieldType(field.Field.Type()) { + if StructFieldMethodCallbacks.IsEnabledFieldType(field.Field.Type()) { // not disabled on scan if _, ok := disableScanField[index]; !ok { if !isNil(field.Field) {