Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 25 for Value (0.21 sec)

  1. tests/default_value_test.go

    	DB.Migrator().DropTable(&Harumph{})
    
    	if err := DB.AutoMigrate(&Harumph{}); err != nil {
    		t.Fatalf("Failed to migrate with default value, got error: %v", err)
    	}
    
    	harumph := Harumph{Email: "******@****.***"}
    	if err := DB.Create(&harumph).Error; err != nil {
    		t.Fatalf("Failed to create data with default value, got error: %v", err)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  2. schema/serializer.go

    }
    
    // Value implements driver.Valuer interface
    func (s serializer) Value() (driver.Value, error) {
    	return s.SerializeValuer.Value(s.Context, s.Field, s.Destination, s.fieldValue)
    }
    
    // SerializerInterface serializer interface
    type SerializerInterface interface {
    	Scan(ctx context.Context, field *Field, dst reflect.Value, dbValue interface{}) error
    	SerializerValuerInterface
    }
    
    // SerializerValuerInterface serializer valuer interface
    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)
  3. callbacks/helper_test.go

    		input  map[string]interface{}
    		expect clause.Values
    	}{
    		{
    			name: "Test convert string value",
    			input: map[string]interface{}{
    				"name": "my name",
    			},
    			expect: clause.Values{
    				Columns: []clause.Column{{Name: "name"}},
    				Values:  [][]interface{}{{"my name"}},
    			},
    		},
    		{
    			name: "Test convert int value",
    			input: map[string]interface{}{
    				"age": 18,
    			},
    			expect: clause.Values{
    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)
  4. scan.go

    						if value := reflect.ValueOf(values[idx]).Elem(); value.Kind() == reflect.Ptr && value.IsNil() {
    							isNilPtrValue = true
    							break
    						}
    
    						relValue.Set(reflect.New(relValue.Type().Elem()))
    						joinedNestedSchemaMap[fullRelsName] = nil
    					}
    				}
    				currentReflectValue = relValue
    			}
    
    			if !isNilPtrValue { // ignore if value is nil
    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)
  5. schema/relationship_test.go

    		},
    	})
    }
    
    func TestMany2ManyWithMultiPrimaryKeys(t *testing.T) {
    	type Tag struct {
    		ID     uint   `gorm:"primary_key"`
    		Locale string `gorm:"primary_key"`
    		Value  string
    	}
    
    	type Blog struct {
    		ID         uint   `gorm:"primary_key"`
    		Locale     string `gorm:"primary_key"`
    		Subject    string
    		Body       string
    		Tags       []Tag `gorm:"many2many:blog_tags;"`
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 25.5K bytes
    - Viewed (0)
  6. migrator/migrator.go

    // RunWithValue run migration with statement value
    func (m Migrator) RunWithValue(value interface{}, fc func(*gorm.Statement) error) error {
    	stmt := &gorm.Statement{DB: m.DB}
    	if m.DB.Statement != nil {
    		stmt.Table = m.DB.Statement.Table
    		stmt.TableExpr = m.DB.Statement.TableExpr
    	}
    
    	if table, ok := value.(string); ok {
    		stmt.Table = table
    	} else if err := stmt.ParseWithSpecialTableName(value, stmt.Table); err != nil {
    		return err
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  7. tests/create_test.go

    	} else if results.RowsAffected != 1 {
    		t.Fatalf("rows affected expects: %v, got %v", 1, results.RowsAffected)
    	}
    
    	if user.ID == 0 {
    		t.Errorf("user's primary key should has value after create, got : %v", user.ID)
    	}
    
    	if user.CreatedAt.IsZero() {
    		t.Errorf("user's created at should be not zero")
    	}
    
    	if user.UpdatedAt.IsZero() {
    		t.Errorf("user's updated at should be not zero")
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 19 03:50:28 GMT 2024
    - 26.4K bytes
    - Viewed (0)
  8. utils/utils.go

    			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()
    		}
    
    		switch v := value.(type) {
    		case string:
    			results[idx] = v
    		case []byte:
    			results[idx] = string(v)
    		case uint:
    			results[idx] = strconv.FormatUint(uint64(v), 10)
    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)
  9. callbacks/create_test.go

    			},
    		},
    		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)
    		Columns: []clause.Column{{Name: "name"}, {Name: "email"}, {Name: "age"}, {Name: "id"}},
    		Values: [][]interface{}{
    			{"alice", "email", 18, 1},
    			{"bob", "email", 19, 2},
    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. callbacks/create.go

    	curTime := stmt.DB.NowFunc()
    
    	switch value := stmt.Dest.(type) {
    	case map[string]interface{}:
    		values = ConvertMapToValuesForCreate(stmt, value)
    	case *map[string]interface{}:
    		values = ConvertMapToValuesForCreate(stmt, *value)
    	case []map[string]interface{}:
    		values = ConvertSliceOfMapToValuesForCreate(stmt, value)
    	case *[]map[string]interface{}:
    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)
Back to top