Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 7 of 7 for tota (0.1 sec)

  1. tests/sql_builder_test.go

    	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 {
    		t.Fatalf("got error %v", err)
    	}
    
    	defer rows.Close()
    	for rows.Next() {
    		var name string
    		var total int64
    		rows.Scan(&name, &total)
    
    		if name == users[0].Name && total != 3 {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  2. schema/relationship.go

    				relation.References = append(relation.References, &Reference{
    					PrimaryKey: rf,
    					ForeignKey: f,
    				})
    			}
    		}
    	}
    }
    
    type guessLevel int
    
    const (
    	guessGuess guessLevel = iota
    	guessBelongs
    	guessEmbeddedBelongs
    	guessHas
    	guessEmbeddedHas
    )
    
    func (schema *Schema) guessRelation(relation *Relationship, field *Field, cgl guessLevel) {
    	var (
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 03:46:59 UTC 2024
    - 22.7K bytes
    - Viewed (0)
  3. tests/group_by_test.go

    		t.Errorf("no error should happen, but got %v", err)
    	}
    
    	if name != "groupby" || total != 60 {
    		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 {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Thu Jan 06 07:02:53 UTC 2022
    - 3.3K bytes
    - Viewed (0)
  4. chainable_api.go

    	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)
    	tx.Statement.AddClause(clause.GroupBy{
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 09:47:34 UTC 2024
    - 14.5K bytes
    - Viewed (0)
  5. tests/query_test.go

    	}); result.Error != nil || result.RowsAffected != 6 {
    		t.Errorf("Failed to batch find, got error %v, rows affected: %v", result.Error, result.RowsAffected)
    	}
    
    	if totalBatch != 6 {
    		t.Errorf("incorrect total batch, expects: %v, got %v", 6, totalBatch)
    	}
    
    	var count int64
    	DB.Model(&User{}).Where("name = ?", "find_in_batches_new").Count(&count)
    	if count != 6 {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 49.8K bytes
    - Viewed (0)
  6. tests/joins_test.go

    	stmt = dryDB.Table(`table_employees`).Select(`id, name, iv.total, iv.paid, iv.balance`).Joins(`LEFT JOIN (?) AS iv ON iv.seller = table_employees.id`, iv).Scan(&user).Statement
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:52:33 UTC 2024
    - 15K bytes
    - Viewed (0)
  7. logger/logger.go

    	MagentaBold = "\033[35;1m"
    	RedBold     = "\033[31;1m"
    	YellowBold  = "\033[33;1m"
    )
    
    // LogLevel log level
    type LogLevel int
    
    const (
    	// Silent silent log level
    	Silent LogLevel = iota + 1
    	// Error error log level
    	Error
    	// Warn warn log level
    	Warn
    	// Info info log level
    	Info
    )
    
    // Writer log writer interface
    type Writer interface {
    	Printf(string, ...interface{})
    }
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Tue Nov 07 02:19:41 UTC 2023
    - 5.8K bytes
    - Viewed (0)
Back to top