- Sort Score
- Result 10 results
- Languages All
Results 1 - 7 of 7 for FieldByName (0.13 sec)
-
schema/constraint_test.go
} for _, name := range []string{"Name", "Constraint"} { if reflect.ValueOf(result).FieldByName(name).Interface() != reflect.ValueOf(v).FieldByName(name).Interface() { t.Errorf( "check %v %v should equal, expects %v, got %v", k, name, reflect.ValueOf(result).FieldByName(name).Interface(), reflect.ValueOf(v).FieldByName(name).Interface(), ) } } } } func TestParseUniqueConstraints(t *testing.T) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sun Feb 04 07:49:19 UTC 2024 - 2.2K bytes - Viewed (0) -
utils/tests/utils.go
ev := reflect.Indirect(reflect.ValueOf(e)) if rv.IsValid() != ev.IsValid() { t.Errorf("%v: expect: %+v, got %+v", utils.FileWithLineNum(), r, e) return } got := rv.FieldByName(name).Interface() expect := ev.FieldByName(name).Interface() t.Run(name, func(t *testing.T) { AssertEqual(t, got, expect) }) } } func AssertEqual(t *testing.T, got, expect interface{}) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Mar 10 09:21:56 UTC 2023 - 3.9K bytes - Viewed (0) -
schema/callbacks_test.go
if !reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) { t.Errorf("%v should be true", str) } } for _, str := range []string{"BeforeCreate", "BeforeUpdate", "AfterUpdate", "AfterSave", "BeforeDelete", "AfterDelete", "AfterFind"} { if reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) { t.Errorf("%v should be false", str) } }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 939 bytes - Viewed (0) -
tests/callbacks_test.go
"runtime" "strings" "testing" "gorm.io/gorm" ) func assertCallbacks(v interface{}, fnames []string) (result bool, msg string) { var ( got []string funcs = reflect.ValueOf(v).Elem().FieldByName("fns") ) for i := 0; i < funcs.Len(); i++ { got = append(got, getFuncName(funcs.Index(i))) } return fmt.Sprint(got) == fmt.Sprint(fnames), fmt.Sprintf("expects %v, got %v", fnames, got) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 26 03:33:36 UTC 2024 - 7.2K bytes - Viewed (0) -
tests/query_test.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 50.4K bytes - Viewed (0) -
schema/schema.go
if methodValue := callBackToMethodValue(modelValue, cbName); methodValue.IsValid() { switch methodValue.Type().String() { case "func(*gorm.DB) error": // TODO hack reflect.Indirect(reflect.ValueOf(schema)).FieldByName(string(cbName)).SetBool(true) default: logger.Default.Warn(context.Background(), "Model %v don't match %vInterface, should be `%v(*gorm.DB) error`. Please see https://gorm.io/docs/hooks.html", schema, cbName, cbName) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 20 12:19:31 UTC 2024 - 13.7K bytes - Viewed (0) -
gorm.go
connPool := db.ConnPool if db.Statement != nil && db.Statement.ConnPool != nil { connPool = db.Statement.ConnPool } if tx, ok := connPool.(*sql.Tx); ok && tx != nil { return (*sql.DB)(reflect.ValueOf(tx).Elem().FieldByName("db").UnsafePointer()), nil } if dbConnector, ok := connPool.(GetDBConnector); ok && dbConnector != nil { if sqldb, err := dbConnector.GetDBConn(); sqldb != nil || err != nil { return sqldb, err }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Oct 09 11:29:48 UTC 2024 - 12.1K bytes - Viewed (0)