Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 9 of 9 for moving (0.17 sec)

  1. clause/group_by_test.go

    				Columns: []clause.Column{{Name: "role"}},
    				Having:  []clause.Expression{clause.Eq{"role", "admin"}},
    			}},
    			"SELECT * FROM `users` GROUP BY `role` HAVING `role` = ?",
    			[]interface{}{"admin"},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.GroupBy{
    				Columns: []clause.Column{{Name: "role"}},
    				Having:  []clause.Expression{clause.Eq{"role", "admin"}},
    			}, clause.GroupBy{
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.1K bytes
    - Viewed (0)
  2. chainable_api.go

    	})
    	return
    }
    
    // Having specify HAVING conditions for GROUP BY
    //
    //	// Select the sum age of users with name jinzhu
    //	db.Model(&User{}).Select("name, sum(age) as total").Group("name").Having("name = ?", "jinzhu").Find(&result)
    func (db *DB) Having(query interface{}, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.AddClause(clause.GroupBy{
    		Having: tx.Statement.BuildCondition(query, args...),
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  3. clause/benchmarks_test.go

    			}},
    			clause.Where{Exprs: []clause.Expression{
    				clause.Or(clause.Gt{Column: "score", Value: 100}, clause.Like{Column: "name", Value: "%linus%"}),
    			}},
    			clause.GroupBy{Columns: []clause.Column{{Name: "role"}}, Having: []clause.Expression{clause.Eq{"role", "admin"}}},
    			clause.Limit{Limit: &limit10, Offset: 20},
    			clause.OrderBy{Columns: []clause.OrderByColumn{{Column: clause.PrimaryColumn, Desc: true}}},
    		}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Oct 07 12:14:14 GMT 2022
    - 1.9K bytes
    - Viewed (0)
  4. tests/postgres_test.go

    	}
    
    	DB.Migrator().DropTable(&Post{}, &Category{}, "post_categories")
    	DB.AutoMigrate(&Post{}, &Category{})
    
    	post := Post{
    		Title: "Hello World",
    		Categories: []*Category{
    			{Title: "Coding"},
    			{Title: "Golang"},
    		},
    	}
    
    	if err := DB.Create(&post).Error; err != nil {
    		t.Errorf("Failed, got error: %v", err)
    	}
    }
    
    func TestPostgresOnConstraint(t *testing.T) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Oct 08 09:16:32 GMT 2022
    - 6.4K bytes
    - Viewed (3)
  5. tests/group_by_test.go

    		t.Errorf("name should be groupby, but got %v, total should be 60, but got %v", name, total)
    	}
    
    	if err := DB.Model(&User{}).Select("name, sum(age) as total").Where("name LIKE ?", "groupby%").Group("name").Having("name = ?", "groupby1").Row().Scan(&name, &total); err != nil {
    		t.Errorf("no error should happen, but got %v", err)
    	}
    
    	if name != "groupby1" || total != 660 {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 3.3K bytes
    - Viewed (0)
  6. clause/group_by.go

    		builder.WriteString(" HAVING ")
    		Where{Exprs: groupBy.Having}.Build(builder)
    	}
    }
    
    // MergeClause merge group by clause
    func (groupBy GroupBy) MergeClause(clause *Clause) {
    	if v, ok := clause.Expression.(GroupBy); ok {
    		copiedColumns := make([]Column, len(v.Columns))
    		copy(copiedColumns, v.Columns)
    		groupBy.Columns = append(copiedColumns, groupBy.Columns...)
    
    		copiedHaving := make([]Expression, len(v.Having))
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Mar 30 10:28:09 GMT 2021
    - 1K bytes
    - Viewed (0)
  7. tests/sql_builder_test.go

    	}
    }
    
    func TestRowsWithGroup(t *testing.T) {
    	users := []User{
    		{Name: "having_user_1", Age: 1},
    		{Name: "having_user_2", Age: 10},
    		{Name: "having_user_1", Age: 20},
    		{Name: "having_user_1", Age: 30},
    	}
    
    	DB.Create(&users)
    
    	rows, err := DB.Select("name, count(*) as total").Table("users").Group("name").Having("name IN ?", []string{users[0].Name, users[1].Name}).Rows()
    	if err != nil {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  8. tests/query_test.go

    	users := []User{
    		{Name: "subquery_having_1", Age: 10},
    		{Name: "subquery_having_2", Age: 20},
    		{Name: "subquery_having_3", Age: 30},
    		{Name: "subquery_having_4", Age: 40},
    	}
    	DB.Create(&users)
    
    	var results []User
    	DB.Select("AVG(age) as avgage").Where("name LIKE ?", "subquery_having%").Group("name").Having("AVG(age) > (?)", DB.
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Mar 15 06:14:48 GMT 2024
    - 49.4K bytes
    - Viewed (0)
  9. schema/field.go

    			if !strings.Contains(v, "create") {
    				field.Creatable = false
    			}
    
    			if !strings.Contains(v, "update") {
    				field.Updatable = false
    			}
    		}
    	}
    
    	// Normal anonymous field or having `EMBEDDED` tag
    	if _, ok := field.TagSettings["EMBEDDED"]; ok || (field.GORMDataType != Time && field.GORMDataType != Bytes && !isValuer &&
    		fieldStruct.Anonymous && (field.Creatable || field.Updatable || field.Readable)) {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 32K bytes
    - Viewed (1)
Back to top