mirror of https://github.com/go-gorm/gorm.git
Remove unnecessary exported method
This commit is contained in:
parent
a343223ac5
commit
e0b90d9770
2
chain.go
2
chain.go
|
@ -38,7 +38,7 @@ func (s *Chain) err(err error) error {
|
|||
}
|
||||
|
||||
func (s *Chain) hasError() bool {
|
||||
return len(s.Errors) > 0
|
||||
return s.Error != nil
|
||||
}
|
||||
|
||||
func (s *Chain) deleteLastError() {
|
||||
|
|
4
do.go
4
do.go
|
@ -302,14 +302,14 @@ func (s *Do) last() {
|
|||
}
|
||||
|
||||
func (s *Do) getForeignKey(from *Model, to *Model, foreign_key string) (err error, from_from bool, foreign_value interface{}) {
|
||||
if has_column, is_slice, value := from.ColumnAndValue(foreign_key); has_column {
|
||||
if has_column, is_slice, value := from.columnAndValue(foreign_key); has_column {
|
||||
from_from = true
|
||||
if is_slice {
|
||||
foreign_value = to.primaryKeyValue()
|
||||
} else {
|
||||
foreign_value = value
|
||||
}
|
||||
} else if has_column, _, _ := to.ColumnAndValue(foreign_key); has_column {
|
||||
} else if has_column, _, _ := to.columnAndValue(foreign_key); has_column {
|
||||
foreign_value = from.primaryKeyValue()
|
||||
} else {
|
||||
err = errors.New("Can't find valid foreign Key")
|
||||
|
|
2
model.go
2
model.go
|
@ -151,7 +151,7 @@ func (m *Model) hasColumn(name string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (m *Model) ColumnAndValue(name string) (has_column bool, is_slice bool, value interface{}) {
|
||||
func (m *Model) columnAndValue(name string) (has_column bool, is_slice bool, value interface{}) {
|
||||
data := m.reflectData()
|
||||
|
||||
if data.Kind() == reflect.Struct {
|
||||
|
|
Loading…
Reference in New Issue