- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 11 for Changes (0.22 sec)
-
finisher_api.go
} return tx } // Commit commits the changes in a transaction func (db *DB) Commit() *DB { if committer, ok := db.Statement.ConnPool.(TxCommitter); ok && committer != nil && !reflect.ValueOf(committer).IsNil() { db.AddError(committer.Commit()) } else { db.AddError(ErrInvalidTransaction) } return db } // Rollback rollbacks the changes in a transaction func (db *DB) Rollback() *DB {
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) -
tests/hooks_test.go
} // Code not changed, price should not change DB.Model(&product).Updates(map[string]interface{}{"Name": "Product New"}) if product.Name != "Product New" || product.Price != 160 || product.Code != "L1212" { t.Errorf("invalid data after update, got %+v", product) } // Code changed, but not selected, price should not change
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) -
tests/upsert_test.go
DB.Where(&User{Name: "find or create 3"}).Assign("age", 55).FirstOrCreate(&user4) if user4.Age != 55 { t.Errorf("Failed to set change to 55, got %v", user4.Age) } if updatedAt1.Format(time.RFC3339Nano) == user4.UpdatedAt.Format(time.RFC3339Nano) { 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)
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) -
tests/main_test.go
func TestSetAndGet(t *testing.T) { if value, ok := DB.Set("hello", "world").Get("hello"); !ok { t.Errorf("Should be able to get setting after set") } else if value.(string) != "world" { t.Errorf("Set value should not be changed") } if _, ok := DB.Get("non_existing"); ok { t.Errorf("Get non existing key should return error") }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Mar 24 01:31:58 GMT 2022 - 1.4K bytes - Viewed (0) -
tests/migrate_test.go
StringBool string SmallintBool int `gorm:"type:smallint"` } type ColumnStruct2 struct { gorm.Model Name string StringBool bool // change existing boolean column from string to boolean SmallintBool bool // change existing boolean column from smallint or other to boolean } DB.Migrator().DropTable(&ColumnStruct{}) if err := DB.AutoMigrate(&ColumnStruct{}); err != nil {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Mar 18 11:24:16 GMT 2024 - 56.2K bytes - Viewed (0) -
tests/update_test.go
if user1UpdatedAt.Format(time.RFC1123Z) == result.UpdatedAt.Format(time.RFC1123Z) { t.Fatalf("user's updated at should be changed, expects: %+v, got: %+v", user1UpdatedAt, result.UpdatedAt) } if user2UpdatedAt.Format(time.RFC1123Z) == user2.UpdatedAt.Format(time.RFC1123Z) { t.Fatalf("user's updated at should be changed, expects: %+v, got: %+v", user2UpdatedAt, user2.UpdatedAt) } DB.First(&result)
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Mon Dec 04 03:50:58 GMT 2023 - 30.3K bytes - Viewed (0) -
statement.go
} } // Changed check model changed or not when updating func (stmt *Statement) Changed(fields ...string) bool { modelValue := stmt.ReflectValue switch modelValue.Kind() { case reflect.Slice, reflect.Array: modelValue = stmt.ReflectValue.Index(stmt.CurDestIndex) } selectColumns, restricted := stmt.SelectAndOmitColumns(false, true) changed := func(field *schema.Field) bool {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 19.8K bytes - Viewed (0) -
tests/multi_primary_keys_test.go
t.Fatalf("CN Blog's tags should not be changed after EN Blog Replace") } var blog11 Blog DB.Preload("LocaleTags").First(&blog11, "id = ? AND locale = ?", blog.ID, blog.Locale) if !compareTags(blog11.LocaleTags, []string{"tag1", "tag2", "tag3"}) { t.Fatalf("CN Blog's tags should not be changed after EN Blog Replace") } DB.Model(&blog2).Association("LocaleTags").Find(&tags2)
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 12.8K bytes - Viewed (0) -
tests/non_std_test.go
DB.First(&animal, animal.Counter) if animal.Name != "galeone" { t.Errorf("Name fields shouldn't be changed if untouched, but got %v", animal.Name) } // When changing a field with a default value, the change must occur animal.Name = "amazing horse" DB.Save(&animal) DB.First(&animal, animal.Counter) if animal.Name != "amazing horse" {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Thu Jan 06 07:02:53 GMT 2022 - 1.9K bytes - Viewed (0) -
tests/sql_builder_test.go
}) assertEqualSQL(t, `SELECT * FROM "users" WHERE id = 100 AND "users"."deleted_at" IS NULL ORDER BY age desc LIMIT 10`, sql) // after model changed if DB.Statement.DryRun || DB.DryRun { t.Fatal("Failed expect DB.DryRun and DB.Statement.ToSQL to be false") } if DB.Statement.SQL.String() != "" { t.Fatal("Failed expect DB.Statement.SQL to be empty")
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Jan 12 08:42:21 GMT 2024 - 16.7K bytes - Viewed (0)