Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 8 of 8 for Gill (0.67 sec)

  1. tests/create_test.go

    	if result.RowsAffected != int64(len(users)) {
    		t.Errorf("affected rows should be %v, but got %v", len(users), result.RowsAffected)
    	}
    
    	for _, user := range users {
    		if user.ID == 0 {
    			t.Fatalf("failed to fill user's ID, got %v", user.ID)
    		} else {
    			var newUser User
    			if err := DB.Where("id = ?", user.ID).Preload(clause.Associations).First(&newUser).Error; err != nil {
    				t.Fatalf("errors happened when query: %v", err)
    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

    )
    
    // Model specify the model you would like to run db operations
    //
    //	// update all users's name to `hello`
    //	db.Model(&User{}).Update("name", "hello")
    //	// if user's primary key is non-blank, will use it as condition, then will only update that user's name to `hello`
    //	db.Model(&user).Update("name", "hello")
    func (db *DB) Model(value interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Model = value
    	return
    }
    
    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. finisher_api.go

    	return
    }
    
    // FirstOrCreate finds the first matching record, otherwise if not found creates a new instance with given conds.
    // Each conds must be a struct or map.
    //
    // Using FirstOrCreate in conjunction with Assign will result in an update to the database even if the record exists.
    //
    //	// assign an email if the record is not found
    //	result := db.Where(User{Name: "non_existing"}).Attrs(User{Email: "******@****.***"}).FirstOrCreate(&user)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  4. tests/migrate_test.go

    			}
    			test.checkFunc(t)
    		})
    	}
    
    	if DB.Dialector.Name() != "sqlserver" {
    		// In SQLServer, If an index or constraint depends on the column,
    		// this column will not be able to run ALTER
    		// see https://stackoverflow.com/questions/19460912/the-object-df-is-dependent-on-column-changing-int-to-double/19461205#19461205
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  5. callbacks/preload.go

    		names = append(names, embeddedValues(relations)...)
    	}
    	return names
    }
    
    // preloadEntryPoint enters layer by layer. It will call real preload if it finds the right entry point.
    // If the current relationship is embedded or joined, current query will be ignored.
    //
    //nolint:cyclop
    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)
  6. tests/preload_test.go

    	if err != nil {
    		t.Errorf("failed to find value, got err: %v", err)
    	}
    	AssertEqual(t, find1, value1)
    
    	var find2 Value
    	// Joins will automatically add Nested queries.
    	err = DB.Joins("Nested.Join").Preload("Nested.Preloads").First(&find2, value2.ID).Error
    	if err != nil {
    		t.Errorf("failed to find value, got err: %v", err)
    	}
    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)
  7. tests/sql_builder_test.go

    		})
    	})
    	assertEqualSQL(t, `SELECT * FROM users ORDER BY id DESC`, sql)
    }
    
    // assertEqualSQL for assert that the sql is equal, this method will ignore quote, and dialect specials.
    func assertEqualSQL(t *testing.T, expected string, actually string) {
    	t.Helper()
    
    	// replace SQL quote, convert into postgresql like ""
    	expected = replaceQuoteInSQL(expected)
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  8. tests/query_test.go

    	}
    }
    
    func TestFindInBatchesWithError(t *testing.T) {
    	if name := DB.Dialector.Name(); name == "sqlserver" {
    		t.Skip("skip sqlserver due to it will raise data race for invalid sql")
    	}
    
    	users := []User{
    		*GetUser("find_in_batches_with_error", Config{}),
    		*GetUser("find_in_batches_with_error", Config{}),
    		*GetUser("find_in_batches_with_error", Config{}),
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top