Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 6 of 6 for ToStringKey (0.2 sec)

  1. callbacks/preload.go

    			for idx, field := range joinRelForeignFields {
    				joinFieldValues[idx], _ = field.ValueOf(tx.Statement.Context, joinIndexValue)
    			}
    
    			if results, ok := joinIdentityMap[utils.ToStringKey(fieldValues...)]; ok {
    				joinKey := utils.ToStringKey(joinFieldValues...)
    				identityMap[joinKey] = append(identityMap[joinKey], results...)
    			}
    		}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  2. schema/utils.go

    		for idx, field := range fields {
    			results[0][idx], zero = field.ValueOf(ctx, reflectValue)
    			notZero = notZero || !zero
    		}
    
    		if !notZero {
    			return nil, nil
    		}
    
    		dataResults[utils.ToStringKey(results[0]...)] = []reflect.Value{reflectValue}
    	case reflect.Slice, reflect.Array:
    		for i := 0; i < reflectValue.Len(); i++ {
    			elem := reflectValue.Index(i)
    			elemKey := elem.Interface()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:35:14 GMT 2023
    - 5.5K bytes
    - Viewed (0)
  3. callbacks/associations.go

    								if pfv, ok := pf.ValueOf(db.Statement.Context, rv); !ok {
    									relPrimaryValues = append(relPrimaryValues, pfv)
    								}
    							}
    							cacheKey := utils.ToStringKey(relPrimaryValues...)
    							if len(relPrimaryValues) != len(rel.FieldSchema.PrimaryFields) || !identityMap[cacheKey] {
    								if cacheKey != "" { // has primary fields
    									identityMap[cacheKey] = true
    								}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  4. utils/utils.go

    // CheckTruth check string true or not
    func CheckTruth(vals ...string) bool {
    	for _, val := range vals {
    		if val != "" && !strings.EqualFold(val, "false") {
    			return true
    		}
    	}
    	return false
    }
    
    func ToStringKey(values ...interface{}) string {
    	results := make([]string, len(values))
    
    	for idx, value := range values {
    		if valuer, ok := value.(driver.Valuer); ok {
    			value, _ = valuer.Value()
    		}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  5. utils/utils_test.go

    		{[]interface{}{[]interface{}{1, 2, 3}}, "[1 2 3]"},
    		{[]interface{}{[]interface{}{"1", "2", "3"}}, "[1 2 3]"},
    		{[]interface{}{[]interface{}{"1", nil, "3"}}, "[1 <nil> 3]"},
    	}
    	for _, c := range cases {
    		if key := ToStringKey(c.values...); key != c.key {
    			t.Errorf("%v: expected %v, got %v", c.values, c.key, key)
    		}
    	}
    }
    
    func TestContains(t *testing.T) {
    	containsTests := []struct {
    		name  string
    		elems []string
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Feb 19 03:42:25 GMT 2024
    - 3.6K bytes
    - Viewed (0)
  6. association.go

    							for idx, field := range rel.FieldSchema.PrimaryFields {
    								primaryValues[idx], _ = field.ValueOf(association.DB.Statement.Context, fieldValue.Index(i))
    							}
    
    							if _, ok := relValuesMap[utils.ToStringKey(primaryValues...)]; !ok {
    								validFieldValues = reflect.Append(validFieldValues, fieldValue.Index(i))
    							}
    						}
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
Back to top