Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for Group (0.14 sec)

  1. chainable_api.go

    	tx.Statement.Joins = append(tx.Statement.Joins, join{Name: query, Conds: args, JoinType: joinType})
    	return
    }
    
    // Group specify the group method on the find
    //
    //	// Select the sum age of users with given names
    //	db.Model(&User{}).Select("name, sum(age) as total").Group("name").Find(&results)
    func (db *DB) Group(name string) (tx *DB) {
    	tx = db.getInstance()
    
    	fields := strings.FieldsFunc(name, utils.IsValidDBNameChar)
    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)
  2. tests/query_test.go

    	}
    	DB.Create(&users)
    
    	var results []User
    	DB.Select("AVG(age) as avgage").Where("name LIKE ?", "subquery_having%").Group("name").Having("AVG(age) > (?)", DB.
    		Select("AVG(age)").Where("name LIKE ?", "subquery_having%").Table("users")).Find(&results)
    
    	if len(results) != 2 {
    		t.Errorf("Two user group should be found, instead found %d", len(results))
    	}
    }
    
    func TestScanNullValue(t *testing.T) {
    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