Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 15 for ValueOf (0.15 sec)

  1. callbacks/helper_test.go

    	vm = make(visitMap)
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); loaded {
    		t.Fatalf("loaded should be false")
    	}
    
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf(&t1)); !loaded {
    		t.Fatalf("loaded should be true")
    	}
    
    	// t1 already exist but t2 not
    	if loaded = loadOrStoreVisitMap(&vm, reflect.ValueOf([]*testM{&t1, &t2, &t3})); loaded {
    		t.Fatalf("loaded should be false")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 05 02:22:57 GMT 2024
    - 3.4K bytes
    - Viewed (0)
  2. scan.go

    		}
    	}
    }
    
    func scanIntoMap(mapValue map[string]interface{}, values []interface{}, columns []string) {
    	for idx, column := range columns {
    		if reflectValue := reflect.Indirect(reflect.Indirect(reflect.ValueOf(values[idx]))); reflectValue.IsValid() {
    			mapValue[column] = reflectValue.Interface()
    			if valuer, ok := mapValue[column].(driver.Valuer); ok {
    				mapValue[column], _ = valuer.Value()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 09:53:11 GMT 2024
    - 9.8K bytes
    - Viewed (0)
  3. schema/serializer.go

    	return
    }
    
    // Value implements serializer interface
    func (UnixSecondSerializer) Value(ctx context.Context, field *Field, dst reflect.Value, fieldValue interface{}) (result interface{}, err error) {
    	rv := reflect.ValueOf(fieldValue)
    	switch v := fieldValue.(type) {
    	case int64, int, uint, uint64, int32, uint32, int16, uint16:
    		result = time.Unix(reflect.Indirect(rv).Int(), 0).UTC()
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 08:28:46 GMT 2024
    - 4.6K bytes
    - Viewed (0)
  4. callbacks/create.go

    							break
    						}
    
    						if _, isZero := pkField.ValueOf(db.Statement.Context, rv); isZero {
    							db.AddError(pkField.Set(db.Statement.Context, rv, insertID))
    							insertID += pkField.AutoIncrementIncrement
    						}
    					}
    				}
    			case reflect.Struct:
    				_, isZero := pkField.ValueOf(db.Statement.Context, db.Statement.ReflectValue)
    				if isZero {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  5. utils/utils.go

    	}
    	return false
    }
    
    func AssertEqual(x, y interface{}) bool {
    	if reflect.DeepEqual(x, y) {
    		return true
    	}
    	if x == nil || y == nil {
    		return false
    	}
    
    	xval := reflect.ValueOf(x)
    	yval := reflect.ValueOf(y)
    	if xval.Kind() == reflect.Ptr && xval.IsNil() ||
    		yval.Kind() == reflect.Ptr && yval.IsNil() {
    		return false
    	}
    
    	if valuer, ok := x.(driver.Valuer); ok {
    		x, _ = valuer.Value()
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 22 06:43:02 GMT 2024
    - 3.8K bytes
    - Viewed (0)
  6. logger/sql.go

    			}
    		case driver.Valuer:
    			reflectValue := reflect.ValueOf(v)
    			if v != nil && reflectValue.IsValid() && ((reflectValue.Kind() == reflect.Ptr && !reflectValue.IsNil()) || reflectValue.Kind() != reflect.Ptr) {
    				r, _ := v.Value()
    				convertParams(r, idx)
    			} else {
    				vars[idx] = nullStr
    			}
    		case fmt.Stringer:
    			reflectValue := reflect.ValueOf(v)
    			switch reflectValue.Kind() {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 21 08:00:02 GMT 2024
    - 5K bytes
    - Viewed (0)
  7. tests/callbacks_test.go

    			callMethod := func(s interface{}, name string, args ...interface{}) {
    				var argValues []reflect.Value
    				for _, arg := range args {
    					argValues = append(argValues, reflect.ValueOf(arg))
    				}
    
    				results := reflect.ValueOf(s).MethodByName(name).Call(argValues)
    				if len(results) > 0 {
    					v = results[0].Interface()
    				}
    			}
    
    			if c.name == "" {
    				c.name = getFuncName(c.h)
    			}
    
    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)
  8. callbacks.go

    			} else {
    				db.AddError(err)
    			}
    		}
    	}
    
    	// assign stmt.ReflectValue
    	if stmt.Dest != nil {
    		stmt.ReflectValue = reflect.ValueOf(stmt.Dest)
    		for stmt.ReflectValue.Kind() == reflect.Ptr {
    			if stmt.ReflectValue.IsNil() && stmt.ReflectValue.CanAddr() {
    				stmt.ReflectValue.Set(reflect.New(stmt.ReflectValue.Type().Elem()))
    			}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  9. callbacks/create_test.go

    		DB: &gorm.DB{
    			Config: &gorm.Config{
    				NowFunc: func() time.Time { return time.Time{} },
    			},
    			Statement: &gorm.Statement{
    				Settings: sync.Map{},
    				Schema:   s,
    			},
    		},
    		ReflectValue: reflect.ValueOf(dest),
    		Dest:         dest,
    	}
    
    	stmt.Schema = s
    
    	values := ConvertToCreateValues(stmt)
    	expected := clause.Values{
    		// column has value + defaultValue column has value (which should have a stable order)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 05:48:42 GMT 2024
    - 1.4K bytes
    - Viewed (0)
  10. prepare_stmt.go

    	return db.PreparedStmtDB.GetDBConn()
    }
    
    func (tx *PreparedStmtTX) Commit() error {
    	if tx.Tx != nil && !reflect.ValueOf(tx.Tx).IsNil() {
    		return tx.Tx.Commit()
    	}
    	return ErrInvalidTransaction
    }
    
    func (tx *PreparedStmtTX) Rollback() error {
    	if tx.Tx != nil && !reflect.ValueOf(tx.Tx).IsNil() {
    		return tx.Tx.Rollback()
    	}
    	return ErrInvalidTransaction
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
Back to top