- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 30 for Unscoped (0.06 sec)
-
callbacks/preload.go
} } else { tx := db.Table("").Session(&gorm.Session{Context: db.Statement.Context, SkipHooks: db.Statement.SkipHooks}) tx.Statement.ReflectValue = db.Statement.ReflectValue tx.Statement.Unscoped = db.Statement.Unscoped if err := preload(tx, rel, append(preloads[name], associationsConds...), preloadMap[name]); err != nil { return err } } } else {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:52:33 UTC 2024 - 11.6K bytes - Viewed (0) -
tests/preload_test.go
if len(user4.Pets) != 0 { t.Fatalf("User.Pet[0] was deleted and should not exist.") } var user5 User DB.Unscoped().Preload(clause.Associations+"."+clause.Associations).Find(&user5, "id = ?", user.ID) CheckUserUnscoped(t, user5, user) var user6 *User DB.Unscoped().Preload("Pets.Toy").Find(&user6, "id = ?", user.ID) CheckUserUnscoped(t, *user6, user) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:00:47 UTC 2024 - 15.9K bytes - Viewed (0) -
chainable_api.go
return } // Unscoped disables the global scope of soft deletion in a query. // By default, GORM uses soft deletion, marking records as "deleted" // by setting a timestamp on a specific field (e.g., `deleted_at`). // Unscoped allows queries to include records marked as deleted, // overriding the soft deletion behavior. // Example: // var users []User // db.Unscoped().Find(&users)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 14.8K bytes - Viewed (0) -
tests/sql_builder_test.go
t.Fatalf("invalid sql generated, got %v", sql) } sql = dryRunDB.Where("a = ? or b = ?", "a", "b").Unscoped().Find(&User{}).Statement.SQL.String() if !regexp.MustCompile(`WHERE a = .+ or b = .+$`).MatchString(sql) { t.Fatalf("invalid sql generated, got %v", sql) } sql = dryRunDB.Or("a = ? or b = ?", "a", "b").Unscoped().Find(&User{}).Statement.SQL.String() if !regexp.MustCompile(`WHERE a = .+ or b = .+$`).MatchString(sql) {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Jan 12 08:42:21 UTC 2024 - 16.7K bytes - Viewed (0) -
gorm.go
Clauses: map[string]clause.Clause{}, Vars: make([]interface{}, 0, 8), SkipHooks: db.Statement.SkipHooks, } if db.Config.PropagateUnscoped { tx.Statement.Unscoped = db.Statement.Unscoped } } else { // with clone statement tx.Statement = db.Statement.clone() tx.Statement.DB = tx } return tx } return db }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Oct 09 11:29:48 UTC 2024 - 12.1K bytes - Viewed (0) -
tests/associations_has_many_test.go
// test delete if err := tx.Model(&item).Association("Contents").Unscoped().Delete(&contents[0]); err != nil { t.Errorf("failed to delete Contents, got error: %v", err) } if count := tx.Model(&item).Association("Contents").Count(); count != 2 { t.Errorf("expected %d contents, got %d", 2, count) } // test clear if err := tx.Model(&item).Association("Contents").Unscoped().Clear(); err != nil {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Jun 12 10:49:45 UTC 2024 - 16K bytes - Viewed (0) -
statement.go
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 19.9K bytes - Viewed (0) -
association.go
} } else { association.Error = err } return association } func (association *Association) Unscoped() *Association { return &Association{ DB: association.DB, Relationship: association.Relationship, Error: association.Error, Unscope: true, } } func (association *Association) Find(out interface{}, conds ...interface{}) error { if association.Error == nil {
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/hooks_test.go
_DB.AutoMigrate(&Product6{}, &ProductItem2{}) p := Product6{ Name: "unique_code", Item: &ProductItem2{}, } _DB.Model(&Product6{}).Create(&p) if err := _DB.Unscoped().Delete(&p).Error; err != nil { t.Fatalf("unscoped did not propagate") }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 17 03:59:06 UTC 2024 - 16.7K bytes - Viewed (0) -
callbacks/create.go
supportReturning := utils.Contains(config.CreateClauses, "RETURNING") return func(db *gorm.DB) { if db.Error != nil { return } if db.Statement.Schema != nil { if !db.Statement.Unscoped { for _, c := range db.Statement.Schema.CreateClauses { db.Statement.AddClause(c) } } if supportReturning && len(db.Statement.Schema.FieldsWithDefaultDBValue) > 0 {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Apr 08 03:29:55 UTC 2024 - 12.5K bytes - Viewed (0)