- Sort Score
- Result 10 results
- Languages All
Results 31 - 40 of 252 for DB (0.01 sec)
-
tests/postgres_test.go
} if err := DB.Exec("CREATE EXTENSION IF NOT EXISTS pgcrypto;").Error; err != nil { t.Errorf("Failed to create extension pgcrypto, got error %v", err) } DB.Migrator().DropTable(&Harumph{}) if err := DB.AutoMigrate(&Harumph{}); err != nil { t.Fatalf("Failed to migrate for uuid default value, got error: %v", err) } harumph := Harumph{} if err := DB.Create(&harumph).Error; err == nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Oct 08 09:16:32 UTC 2022 - 6.4K bytes - Viewed (0) -
tests/benchmark_test.go
DB.Raw("select * from users where id = ?", user.ID).Scan(&u) } } func BenchmarkScanSlice(b *testing.B) { DB.Exec("delete from users") for i := 0; i < 10_000; i++ { user := *GetUser(fmt.Sprintf("scan-%d", i), Config{}) DB.Create(&user) } var u []User b.ResetTimer() for x := 0; x < b.N; x++ { DB.Raw("select * from users").Scan(&u) } } func BenchmarkScanSlicePointer(b *testing.B) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 01 03:50:57 UTC 2022 - 1.5K bytes - Viewed (0) -
association.go
type Association struct { DB *DB Relationship *schema.Relationship Unscope bool Error error } func (db *DB) Association(column string) *Association { association := &Association{DB: db} table := db.Statement.Table if err := db.Statement.Parse(db.Statement.Model); err == nil { db.Statement.Table = table association.Relationship = db.Statement.Schema.Relationships.Relations[column]
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 21.5K bytes - Viewed (0) -
tests/upsert_test.go
if err := DB.Clauses(clause.OnConflict{DoNothing: true}).Create(&lang).Error; err != nil { t.Fatalf("failed to upsert, got %v", err) } lang2 := Language{Code: "upsert", Name: "Upsert"} if err := DB.Clauses(clause.OnConflict{DoNothing: true}).Create(&lang2).Error; err != nil { t.Fatalf("failed to upsert, got %v", err) } var langs []Language
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Sep 05 07:39:19 UTC 2022 - 11.4K bytes - Viewed (0) -
tests/callbacks_test.go
} func c1(*gorm.DB) {} func c2(*gorm.DB) {} func c3(*gorm.DB) {} func c4(*gorm.DB) {} func c5(*gorm.DB) {} func c6(*gorm.DB) {} func TestCallbacks(t *testing.T) { type callback struct { name string before string after string remove bool replace bool err string match func(*gorm.DB) bool h func(*gorm.DB) } datas := []struct {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 26 03:33:36 UTC 2024 - 7.2K bytes - Viewed (0) -
tests/error_translator_test.go
if supported, found := dialectors[db.Dialector.Name()]; !(found && supported) { return } DB.Migrator().DropTable(&City{}) if err = db.AutoMigrate(&City{}); err != nil { t.Fatalf("failed to migrate cities table, got error: %v", err) } err = db.Create(&City{Name: "Kabul"}).Error if err != nil { t.Fatalf("failed to create record: %v", err) } err = db.Create(&City{Name: "Kabul"}).Error
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jul 12 13:21:22 UTC 2023 - 3.1K bytes - Viewed (0) -
tests/associations_has_many_test.go
user := *GetUser("hasmany", Config{Pets: 2}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckUser(t, user, user) // Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Pets").Find(&user2.Pets) CheckUser(t, user2, user) var pets []Pet DB.Model(&user).Where("name = ?", user.Pets[0].Name).Association("Pets").Find(&pets)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
tests/associations_has_one_test.go
) func TestHasOneAssociation(t *testing.T) { user := *GetUser("hasone", Config{Account: true}) if err := DB.Create(&user).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } CheckUser(t, user, user) // Find var user2 User DB.Find(&user2, "id = ?", user.ID) DB.Model(&user2).Association("Account").Find(&user2.Account) CheckUser(t, user2, user) // Count
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 7.1K bytes - Viewed (0) -
callbacks/interfaces.go
type BeforeCreateInterface interface { BeforeCreate(*gorm.DB) error } type AfterCreateInterface interface { AfterCreate(*gorm.DB) error } type BeforeUpdateInterface interface { BeforeUpdate(*gorm.DB) error } type AfterUpdateInterface interface { AfterUpdate(*gorm.DB) error } type BeforeSaveInterface interface { BeforeSave(*gorm.DB) error } type AfterSaveInterface interface {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 27 07:03:57 UTC 2020 - 667 bytes - Viewed (0) -
tests/gorm_test.go
t.Fatalf("rows affected expects: %v, got %v", 1, results.RowsAffected) } u1 = user{} // important to reinitialize this before creating it again u2 := user{} db := DB.Session(&gorm.Session{CreateBatchSize: 10}) if results := db.Create([]*user{&u1, &u2}); results.Error != nil { t.Fatalf("errors happened on create: %v", results.Error) } else if results.RowsAffected != 2 {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jun 01 07:22:21 UTC 2023 - 3.3K bytes - Viewed (0)