- Sort Score
- Result 10 results
- Languages All
Results 1 - 10 of 168 for Preload (0.06 sec)
-
callbacks/preload.go
identityMap, foreignValues = schema.GetIdentityFieldValuesMap(tx.Statement.Context, reflectValue, foreignFields) if len(foreignValues) == 0 { return nil } } // nested preload for p, pvs := range preloads { tx = tx.Preload(p, pvs...) } reflectResults := rel.FieldSchema.MakeSlice().Elem() column, values := schema.ToQueryValues(clause.CurrentTable, relForeignKeys, foreignValues) if len(values) != 0 {
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
t.Fatalf("Expected first query to preload manager tools, got: %s", query[0]) } } func TestNestedPreloadWithPointerJoin(t *testing.T) { type ( Preload struct { ID uint Value string JoinID uint } Join struct { ID uint Value string Preload Preload NestedID uint } Nested struct { ID uint Join Join
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/create_test.go
t.Fatalf("errors happened when create: %v", err) } CheckUser(t, user, user) var user2 User DB.Preload("Account").Preload("Pets").Preload("Toys").Preload("Company").Preload("Manager").Preload("Team").Preload("Languages").Preload("Friends").Find(&user2, "id = ?", user.ID) CheckUser(t, user2, user) } func TestBulkCreateWithAssociations(t *testing.T) { users := []User{
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Tue Mar 19 03:50:28 UTC 2024 - 26.4K bytes - Viewed (0) -
tests/update_test.go
result.Friends = user2.Friends DB.Select("Name", "Account", "Toys", "Manager", "ManagerID", "Languages").Save(&result) var result2 User DB.Preload("Account").Preload("Pets").Preload("Toys").Preload("Company").Preload("Manager").Preload("Team").Preload("Languages").Preload("Friends").First(&result2, user.ID) result.Languages = append(user.Languages, result.Languages...) result.Toys = append(user.Toys, result.Toys...)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Dec 04 03:50:58 UTC 2023 - 30.3K bytes - Viewed (0) -
tests/associations_test.go
func TestAssociationError(t *testing.T) { user := *GetUser("TestAssociationError", Config{Pets: 2, Company: true, Account: true, Languages: 2}) DB.Create(&user) var user1 User DB.Preload("Company").Preload("Pets").Preload("Account").Preload("Languages").First(&user1) var emptyUser User var err error // belongs to err = DB.Model(&emptyUser).Association("Company").Delete(&user1.Company)
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Wed Feb 08 08:29:09 UTC 2023 - 10.9K bytes - Viewed (0) -
errors.go
// ErrInvalidValueOfLength invalid values do not match length ErrInvalidValueOfLength = errors.New("invalid association values, length doesn't match") // ErrPreloadNotAllowed preload is not allowed when count is used ErrPreloadNotAllowed = errors.New("preload is not allowed when count is used") // ErrDuplicatedKey occurs when there is a unique key constraint violation ErrDuplicatedKey = errors.New("duplicated key not allowed")
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Fri Apr 26 02:53:17 UTC 2024 - 2.5K bytes - Viewed (0) -
tests/associations_many2many_test.go
AssertEqual(t, nil, err) var findUser1 User err = DB.Preload("Languages").Where("id = ?", user1.ID).First(&findUser1).Error AssertEqual(t, nil, err) AssertEqual(t, user1, findUser1) var findUser2 User err = DB.Preload("Languages").Where("id = ?", user2.ID).First(&findUser2).Error AssertEqual(t, nil, err) AssertEqual(t, user2, findUser2) }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Sat Jun 10 13:05:19 UTC 2023 - 13.2K bytes - Viewed (0) -
tests/count_test.go
Preload("Toys", func(db *gorm.DB) *gorm.DB { return db.Table("toys").Select("name") }).Count(&count12).Error; err == nil { t.Errorf("error should raise when using preload without schema") } var count13 int64 if err := DB.Model(User{}). Where("name in ?", []string{user1.Name, user2.Name, user3.Name}). Preload("Toys", func(db *gorm.DB) *gorm.DB {
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Oct 30 09:15:49 UTC 2023 - 6.9K bytes - Viewed (0) -
callbacks/query.go
} db.Statement.AddClauseIfNotExists(clauseSelect) db.Statement.Build(db.Statement.BuildClauses...) } } func Preload(db *gorm.DB) { if db.Error == nil && len(db.Statement.Preloads) > 0 { if db.Statement.Schema == nil { db.AddError(fmt.Errorf("%w when using preload", gorm.ErrModelValueRequired)) return } joins := make([]string, 0, len(db.Statement.Joins))
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Thu Aug 22 11:03:42 UTC 2024 - 10.1K bytes - Viewed (1) -
chainable_api.go
db = scope(db) } return db } // Preload preload associations with given conditions // // // get all users, and preload all non-cancelled orders // db.Preload("Orders", "state NOT IN (?)", "cancelled").Find(&users) func (db *DB) Preload(query string, args ...interface{}) (tx *DB) { tx = db.getInstance() if tx.Statement.Preloads == nil { tx.Statement.Preloads = map[string][]interface{}{} }
Registered: Sun Nov 03 09:35:10 UTC 2024 - Last Modified: Mon Jun 24 09:42:59 UTC 2024 - 14.8K bytes - Viewed (0)