- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 12 for second (0.29 sec)
-
tests/upsert_test.go
user.Age = 20 if err := DB.Create(&user).Error; err != nil { t.Errorf("failed to create user, got error %v", err) } var user2 User DB.First(&user2, user.ID) user2.Age = 30 time.Sleep(time.Second) if err := DB.Clauses(clause.OnConflict{UpdateAll: true}).Create(&user2).Error; err != nil { t.Fatalf("failed to onconflict create user, got error %v", err) } else { var user3 User DB.First(&user3, user.ID)
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/create_test.go
supportLastInsertID := isMysql() || isSqlite() // case 1: create from map[string]interface{} record := map[string]interface{}{"name": "create_from_map_with_table", "age": 18} if err := tableDB.Create(record).Error; err != nil { t.Fatalf("failed to create data from map with table, got error: %v", err) } if _, ok := record["@id"]; !ok && supportLastInsertID {
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) -
tests/joins_test.go
Joins("JOIN languages ON languages.code = user_speaks.language_code"). Joins("LEFT OUTER JOIN pets ON pets.user_id = users.id").Find(&results) if len(results) == 0 { t.Fatalf("no record find") } else if results[0].Pet.UserID == nil || *(results[0].Pet.UserID) != user.ID { t.Fatalf("wrong user id in pet") } else if results[0].Pet.Name != user.Pets[0].Name { t.Fatalf("wrong pet name") } }
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Apr 26 14:19:32 GMT 2023 - 13.5K bytes - Viewed (1) -
tests/update_test.go
t.Errorf("should only update one record, but got %v", rowsAffected) } if rowsAffected := DB.Model(users).Where("age > 0").Update("name", "jinzhu").RowsAffected; rowsAffected != 3 { t.Errorf("should only update one record, but got %v", rowsAffected) } } func TestUpdates(t *testing.T) { users := []*User{
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) -
tests/hooks_test.go
} if DB.Where("Code = ?", "unique_code").First(&p).Error == nil { t.Fatalf("Can't find a deleted record") } beforeCallTimes := p.AfterFindCallTimes if DB.Where("Code = ?", "unique_code").Find(&p).Error != nil { t.Fatalf("Find don't raise error when record not found") } if p.AfterFindCallTimes != beforeCallTimes { t.Fatalf("AfterFind should not be called") } }
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) -
chainable_api.go
tx = db.getInstance() var whereConds []interface{} for _, cond := range conds { if c, ok := cond.(clause.Interface); ok { tx.Statement.AddClause(c) } else if optimizer, ok := cond.(StatementModifier); ok { optimizer.ModifyStatement(tx.Statement) } else { whereConds = append(whereConds, cond) } } if len(whereConds) > 0 {
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) -
finisher_api.go
} return } // FirstOrCreate finds the first matching record, otherwise if not found creates a new instance with given conds. // Each conds must be a struct or map. // // Using FirstOrCreate in conjunction with Assign will result in an update to the database even if the record exists. // // // assign an email if the record is not found
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/transaction_test.go
t.Fatalf("Should find saved record") } if err := DB.First(&User{}, "name = ?", user1.Name).Error; err == nil { t.Fatalf("Should not find rollbacked record") } if err := DB.First(&User{}, "name = ?", user2.Name).Error; err != nil { t.Fatalf("Should find saved record") } } func TestNestedTransactionWithBlock(t *testing.T) { var (
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Jun 10 13:05:19 GMT 2023 - 10.9K bytes - Viewed (0) -
tests/scanner_valuer_test.go
ExampleStructPtr: &ExampleStruct{"name", "value2"}, } var result ScannerValuerStruct tx := DB.Where(data).FirstOrCreate(&result) if tx.RowsAffected != 1 { t.Errorf("RowsAffected should be 1 after create some record") } if tx.Error != nil { t.Errorf("Should not raise any error, but got %v", tx.Error) } AssertObjEqual(t, result, data, "Name", "Gender", "Age")
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Wed Jun 07 07:02:07 GMT 2023 - 10.6K bytes - Viewed (0) -
tests/sql_builder_test.go
}, ) newDB.Joins("inner join rgs on rgs.id = user.id") stmt := newDB.First(&result).Statement str := stmt.SQL.String() if !strings.Contains(str, "rgs.id = user.id") { t.Errorf("The second join condition is over written instead of combining") } if !strings.Contains(str, "`users`.`company_id` = `companies`.`id`") && !strings.Contains(str, "\"users\".\"company_id\" = \"companies\".\"id\"") {
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)