- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 20 for KSession (0.2 sec)
-
tests/create_test.go
*GetUser("create_with_default_batch_sizs_6", Config{Account: true, Pets: 4, Toys: 3, Company: false, Manager: true, Team: 1, Languages: 3, Friends: 0}), } result := DB.Session(&gorm.Session{CreateBatchSize: 2}).Create(&users) if result.RowsAffected != int64(len(users)) { t.Errorf("affected rows should be %v, but got %v", len(users), result.RowsAffected) } for _, user := range users {
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
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/associations_has_many_test.go
} type Item struct { gorm.Model Logo string `gorm:"not null;type:varchar(50)"` Contents []ItemContent `gorm:"foreignKey:ItemID"` } tx := DB.Session(&gorm.Session{}) tx.Migrator().DropTable(&ItemContent{}, &Item{}) tx.AutoMigrate(&ItemContent{}, &Item{}) item := Item{ Logo: "logo", Contents: []ItemContent{ {Name: "name", LanguageCode: "en"},
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Dec 15 08:36:08 GMT 2023 - 15.6K bytes - Viewed (0) -
callbacks/associations.go
} for i := 0; i < elemLen; i++ { appendToJoins(objs[i], elems.Index(i)) } } if joins.Len() > 0 { db.AddError(db.Session(&gorm.Session{NewDB: true}).Clauses(clause.OnConflict{DoNothing: true}).Session(&gorm.Session{ SkipHooks: db.Statement.SkipHooks, DisableNestedTransaction: true, }).Create(joins.Interface()).Error) } } } } }
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) -
migrator/migrator.go
} } return } func (m Migrator) GetQueryAndExecTx() (queryTx, execTx *gorm.DB) { queryTx = m.DB.Session(&gorm.Session{}) execTx = queryTx if m.DB.DryRun { queryTx.DryRun = false execTx = m.DB.Session(&gorm.Session{Logger: &printSQLLogger{Interface: m.DB.Logger}}) } return queryTx, execTx } // AutoMigrate auto migrate values
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Fri Apr 26 07:15:49 GMT 2024 - 29K bytes - Viewed (0) -
tests/hooks_test.go
} DB.Model(&product).Session(&gorm.Session{SkipHooks: true}).Updates(Product3{Code: "L1216"}) if product.Price != 320 || product.Code != "L1216" { t.Errorf("invalid data after update, got %+v", product) } var result2 Product3 DB.First(&result2, product.ID) AssertEqual(t, result2, product) product2 := Product3{Name: "Product", Price: 0} DB.Session(&gorm.Session{SkipHooks: true}).Create(&product2)
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
} if name := DB.Dialector.Name(); name != "sqlserver" { type RestrictedLanguage struct { Code string `gorm:"primarykey"` Name string Lang string `gorm:"<-:create"` } r := DB.Session(&gorm.Session{DryRun: true}).Clauses(clause.OnConflict{UpdateAll: true}).Create(&RestrictedLanguage{Code: "upsert_code", Name: "upsert_name", Lang: "upsert_lang"})
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) -
finisher_api.go
if !selectedUpdate { tx.Statement.Selects = append(tx.Statement.Selects, "*") } updateTx := tx.callbacks.Update().Execute(tx.Session(&Session{Initialized: true})) if updateTx.Error == nil && updateTx.RowsAffected == 0 && !updateTx.DryRun && !selectedUpdate { return tx.Session(&Session{SkipHooks: true}).Clauses(clause.OnConflict{UpdateAll: true}).Create(value) } return updateTx } return }
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/table_test.go
) type UserWithTable struct { gorm.Model Name string } func (UserWithTable) TableName() string { return "gorm.user" } func TestTable(t *testing.T) { dryDB := DB.Session(&gorm.Session{DryRun: true}) r := dryDB.Table("`user`").Find(&User{}).Statement if !regexp.MustCompile("SELECT \\* FROM `user`").MatchString(r.Statement.SQL.String()) {
Go - Registered: Sun May 05 09:35:13 GMT 2024 - Last Modified: Sat Mar 09 09:31:28 GMT 2024 - 10.6K bytes - Viewed (0) -
tests/transaction_test.go
if err := DB.First(&User{}, "name = ?", "transaction").Error; err == nil { t.Fatalf("Should not find record after rollback, but got %v", err) } txDB := DB.Where("fake_name = ?", "fake_name") tx2 := txDB.Session(&gorm.Session{NewDB: true}).Begin() user2 := *GetUser("transaction-2", Config{}) if err := tx2.Save(&user2).Error; err != nil { t.Fatalf("No error should raise, but got %v", err) }
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)