Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 20 for _values (0.25 sec)

  1. scan.go

    	for idx, field := range fields {
    		if field != nil {
    			values[idx] = field.NewValuePool.Get()
    		} else if len(fields) == 1 {
    			if reflectValue.CanAddr() {
    				values[idx] = reflectValue.Addr().Interface()
    			} else {
    				values[idx] = reflectValue.Interface()
    			}
    		}
    	}
    
    	db.RowsAffected++
    	db.AddError(rows.Scan(values...))
    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)
  2. tests/create_test.go

    	}
    
    	// case 3: records
    	values := []map[string]interface{}{
    		{"name": "create_from_map_with_schema11", "age": 1}, {"name": "create_from_map_with_schema12", "age": 1},
    	}
    
    	beforeLen := len(values)
    	if err := DB.Model(&User{}).Create(&values).Error; err != nil {
    		t.Fatalf("failed to create data from map, got error: %v", err)
    	}
    
    	// mariadb with returning, values will be appended with id map
    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)
  3. callbacks/associations.go

    		tx = tx.Omit(omits...)
    	}
    
    	return db.AddError(tx.Create(values).Error)
    }
    
    // check association values has been saved
    // if values kind is Struct, check it has been saved
    // if values kind is Slice/Array, check all items have been saved
    var visitMapStoreKey = "gorm:saved_association_map"
    
    func checkAssociationsSaved(db *gorm.DB, values reflect.Value) bool {
    	if visit, ok := db.Get(visitMapStoreKey); ok {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  4. tests/preload_suits_test.go

    	want[0] = Level3{
    		Level2: Level2{
    			Level1s: []Level1{
    				{Value: "value1"},
    				{Value: "value2"},
    			},
    		},
    		Level2_1: Level2_1{
    			Level1s: []Level1{
    				{
    					Value:   "value1-1",
    					Level0s: []Level0{{Value: "Level0-1"}},
    				},
    				{
    					Value:   "value2-2",
    					Level0s: []Level0{{Value: "Level0-2"}},
    				},
    			},
    		},
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Mar 18 05:38:46 GMT 2022
    - 30.3K bytes
    - Viewed (0)
  5. migrator/migrator.go

    			return err
    		}
    	}
    	return nil
    }
    
    // DropTable drop table for values
    func (m Migrator) DropTable(values ...interface{}) error {
    	values = m.ReorderModels(values, false)
    	for i := len(values) - 1; i >= 0; i-- {
    		tx := m.DB.Session(&gorm.Session{})
    		if err := m.RunWithValue(values[i], func(stmt *gorm.Statement) error {
    			return tx.Exec("DROP TABLE IF EXISTS ?", m.CurrentTable(stmt)).Error
    		}); err != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 07:15:49 GMT 2024
    - 29K bytes
    - Viewed (0)
  6. chainable_api.go

    	tx.Statement.Unscoped = true
    	return
    }
    
    func (db *DB) Raw(sql string, values ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.SQL = strings.Builder{}
    
    	if strings.Contains(sql, "@") {
    		clause.NamedExpr{SQL: sql, Vars: values}.Build(tx.Statement)
    	} else {
    		clause.Expr{SQL: sql, Vars: values}.Build(tx.Statement)
    	}
    	return
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  7. tests/hooks_test.go

    	}
    
    	DB.Create(&products)
    
    	for idx, value := range []int64{200, 300, 400} {
    		if products[idx].Price != value {
    			t.Errorf("invalid price for product #%v, expects: %v, got %v", idx, value, products[idx].Price)
    		}
    	}
    
    	DB.Model(&products).Update("Name", "product-name")
    
    	// will set all product's price to last product's price + 10
    	for idx, value := range []int64{410, 410, 410} {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  8. tests/upsert_test.go

    		t.Errorf("UpdateAt should be changed when update values with assign")
    	}
    
    	DB.Where(&User{Name: "find or create 4"}).Assign(User{Age: 44}).FirstOrCreate(&user4)
    	if user4.Name != "find or create 4" || user4.ID == 0 || user4.Age != 44 {
    		t.Errorf("user should be created with search value and assigned attrs")
    	}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Sep 05 07:39:19 GMT 2022
    - 11.4K bytes
    - Viewed (0)
  9. callbacks/create.go

    				if vs, ok := defaultValueFieldsHavingValue[field]; ok {
    					values.Columns = append(values.Columns, clause.Column{Name: field.DBName})
    					for idx := range values.Values {
    						if vs[idx] == nil {
    							values.Values[idx] = append(values.Values[idx], stmt.DefaultValueOf(field))
    						} else {
    							values.Values[idx] = append(values.Values[idx], vs[idx])
    						}
    					}
    				}
    			}
    		case reflect.Struct:
    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)
  10. finisher_api.go

    	default:
    		tx = db.getInstance()
    		tx.Statement.Dest = value
    		tx = tx.callbacks.Create().Execute(tx)
    	}
    	return
    }
    
    // Save updates value in database. If value doesn't contain a matching primary key, value is inserted.
    func (db *DB) Save(value interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Dest = value
    
    	reflectValue := reflect.Indirect(reflect.ValueOf(value))
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
Back to top