- Sort Score
- Result 10 results
- Languages All
Results 1 - 8 of 8 for FieldByName (0.08 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) -
api/go1.txt
pkg reflect, method (Value) Complex() complex128 pkg reflect, method (Value) Elem() Value pkg reflect, method (Value) Field(int) Value pkg reflect, method (Value) FieldByIndex([]int) Value pkg reflect, method (Value) FieldByName(string) Value pkg reflect, method (Value) FieldByNameFunc(func(string) bool) Value pkg reflect, method (Value) Float() float64 pkg reflect, method (Value) Index(int) Value pkg reflect, method (Value) Int() int64
Registered: Tue Nov 05 11:13:11 UTC 2024 - Last Modified: Wed Aug 14 18:58:28 UTC 2013 - 1.7M bytes - Viewed (0)