Source File
callmethod.go
Belonging Package
gorm.io/gorm/callbacks
package callbacks
import (
)
func callMethod( *gorm.DB, func( interface{}, *gorm.DB) bool) {
:= .Session(&gorm.Session{NewDB: true})
if := (.Statement.ReflectValue.Interface(), ); ! {
switch .Statement.ReflectValue.Kind() {
case reflect.Slice, reflect.Array:
.Statement.CurDestIndex = 0
for := 0; < .Statement.ReflectValue.Len(); ++ {
if := reflect.Indirect(.Statement.ReflectValue.Index()); .CanAddr() {
(.Addr().Interface(), )
} else {
.AddError(gorm.ErrInvalidValue)
return
}
.Statement.CurDestIndex++
}
case reflect.Struct:
if .Statement.ReflectValue.CanAddr() {
(.Statement.ReflectValue.Addr().Interface(), )
} else {
.AddError(gorm.ErrInvalidValue)
}
}
}
}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |