Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for FieldByName (0.21 sec)

  1. 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)
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  2. tests/query_test.go

    							t.Errorf("invalid data type for %v, got %#v", dbName, first[dbName])
    						}
    					}
    
    					reflectValue := reflect.Indirect(reflect.ValueOf(users[0]))
    					AssertEqual(t, first[dbName], reflectValue.FieldByName(name).Interface())
    				})
    			}
    		}
    	})
    
    	t.Run("FirstMapWithTable", func(t *testing.T) {
    		first := map[string]interface{}{}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top