Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for payload (0.18 sec)

  1. 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{
    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)
  2. chainable_api.go

    	db.Statement.scopes = nil
    	for _, scope := range scopes {
    		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 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  3. 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")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Apr 26 02:53:17 GMT 2024
    - 2.5K bytes
    - Viewed (0)
  4. 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 {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 11.6K bytes
    - Viewed (0)
  5. tests/preload_test.go

    	DB.Preload(clause.Associations+"."+clause.Associations).Find(&user3, "id = ?", user.ID)
    	CheckUser(t, user3, user)
    
    	var user4 *User
    	DB.Preload("Pets.Toy").Find(&user4, "id = ?", user.ID)
    	CheckUser(t, *user4, user)
    }
    
    func TestNestedPreloadForSlice(t *testing.T) {
    	users := []User{
    		*GetUser("slice_nested_preload_1", Config{Pets: 2}),
    		*GetUser("slice_nested_preload_2", Config{Pets: 0}),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:21:03 GMT 2024
    - 14.9K bytes
    - Viewed (0)
Back to top