- Sort Score
- Result 10 results
- Languages All
Results 11 - 20 of 252 for DB (0.03 sec)
-
tests/multi_primary_keys_test.go
} func TestManyToManyWithMultiPrimaryKeys(t *testing.T) { if name := DB.Dialector.Name(); name == "sqlite" || name == "sqlserver" { t.Skip("skip sqlite, sqlserver due to it doesn't support multiple primary keys with auto increment") } if name := DB.Dialector.Name(); name == "postgres" { stmt := gorm.Statement{DB: DB} stmt.Parse(&Blog{}) stmt.Schema.LookUpField("ID").Unique = true stmt.Parse(&Tag{})
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Jan 06 07:02:53 UTC 2022 - 12.8K bytes - Viewed (0) -
gorm.go
if errTranslator, ok := db.Dialector.(ErrorTranslator); ok { err = errTranslator.Translate(err) } } if db.Error == nil { db.Error = err } else { db.Error = fmt.Errorf("%v; %w", db.Error, err) } } return db.Error } // DB returns `*sql.DB` func (db *DB) DB() (*sql.DB, error) { connPool := db.ConnPool if db.Statement != nil && db.Statement.ConnPool != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Oct 09 11:29:48 UTC 2024 - 12.1K bytes - Viewed (0) -
callbacks/query.go
"gorm.io/gorm/schema" "gorm.io/gorm/utils" ) func Query(db *gorm.DB) { if db.Error == nil { BuildQuerySQL(db) if !db.DryRun && db.Error == nil { rows, err := db.Statement.ConnPool.QueryContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...) if err != nil { db.AddError(err) return } defer func() { db.AddError(rows.Close()) }() gorm.Scan(rows, db, 0) } }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 22 11:03:42 UTC 2024 - 10.1K bytes - Viewed (1) -
tests/preload_test.go
CheckUser(t, u, users[i]) } var user4 User DB.Delete(&users3[0].Account) if err := DB.Preload(clause.Associations).Take(&user4, "id = ?", users3[0].ID).Error; err != nil || user4.Account.ID != 0 { t.Errorf("failed to query, got error %v, account: %#v", err, user4.Account) } if err := DB.Preload(clause.Associations, func(tx *gorm.DB) *gorm.DB { return tx.Unscoped()
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0) -
tests/preload_suits_test.go
{ Value: "Level3-3", Level2: level21, }, } for _, want := range wants { if err := DB.Save(want).Error; err != nil { t.Error(err) } } var gots []*Level3 if err := DB.Preload("Level2.Level1s", func(db *gorm.DB) *gorm.DB { return db.Order("level1.id ASC") }).Find(&gots).Error; err != nil { t.Error(err) } if !reflect.DeepEqual(gots, wants) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Mar 18 05:38:46 UTC 2022 - 30.3K bytes - Viewed (0) -
finisher_api.go
func (db *DB) Create(value interface{}) (tx *DB) { if db.CreateBatchSize > 0 { return db.CreateInBatches(value, db.CreateBatchSize) } tx = db.getInstance() tx.Statement.Dest = value return tx.callbacks.Create().Execute(tx) } // CreateInBatches inserts value in batches of batchSize func (db *DB) CreateInBatches(value interface{}, batchSize int) (tx *DB) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Sep 14 12:58:29 UTC 2024 - 22.8K bytes - Viewed (0) -
tests/create_test.go
}} if err := DB.Create(&pets).Error; err != nil { t.Fatalf("errors happened when create: %v", err) } for _, pet := range pets { CheckPet(t, *pet, *pet) } }) } func TestCreateEmptyStruct(t *testing.T) { type EmptyStruct struct { ID uint } DB.Migrator().DropTable(&EmptyStruct{}) if err := DB.AutoMigrate(&EmptyStruct{}); err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0) -
callbacks/raw.go
package callbacks import ( "gorm.io/gorm" ) func RawExec(db *gorm.DB) { if db.Error == nil && !db.DryRun { result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...) if err != nil { db.AddError(err) return } db.RowsAffected, _ = result.RowsAffected() }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Nov 29 01:33:20 UTC 2021 - 336 bytes - Viewed (0) -
tests/serializer_test.go
} if err := DB.Create(&data).Error; err != nil { t.Fatalf("failed to create data, got error %v", err) } var result SerializerStruct if err := DB.Where("roles2 IS NULL AND roles3 = ?", "").First(&result, data.ID).Error; err != nil { t.Fatalf("failed to query data, got error %v", err) } AssertEqual(t, result, data) if err := DB.Model(&result).Update("roles", "").Error; err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Apr 21 14:09:38 UTC 2023 - 7.6K bytes - Viewed (0) -
callbacks/preload.go
tx := db.Session(&gorm.Session{Context: db.Statement.Context, NewDB: true, SkipHooks: db.Statement.SkipHooks, Initialized: true}) db.Statement.Settings.Range(func(k, v interface{}) bool { tx.Statement.Settings.Store(k, v) return true }) if err := tx.Statement.Parse(dest); err != nil { tx.AddError(err) return tx } tx.Statement.ReflectValue = reflectValue
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:52:33 UTC 2024 - 11.6K bytes - Viewed (0)