Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 35 for from (0.8 sec)

  1. clause/from.go

    package clause
    
    // From from clause
    type From struct {
    	Tables []Table
    	Joins  []Join
    }
    
    // Name from clause name
    func (from From) Name() string {
    	return "FROM"
    }
    
    // Build build from clause
    func (from From) Build(builder Builder) {
    	if len(from.Tables) > 0 {
    		for idx, table := range from.Tables {
    			if idx > 0 {
    				builder.WriteByte(',')
    			}
    
    			builder.WriteQuoted(table)
    		}
    	} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 630 bytes
    - Viewed (0)
  2. clause/from_test.go

    	results := []struct {
    		Clauses []clause.Interface
    		Result  string
    		Vars    []interface{}
    	}{
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}},
    			"SELECT * FROM `users`", nil,
    		},
    		{
    			[]clause.Interface{
    				clause.Select{}, clause.From{
    					Tables: []clause.Table{{Name: "users"}},
    					Joins: []clause.Join{
    						{
    							Type:  clause.InnerJoin,
    							Table: clause.Table{Name: "articles"},
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jul 15 02:25:10 GMT 2020
    - 1.9K bytes
    - Viewed (0)
  3. tests/benchmark_test.go

    	for x := 0; x < b.N; x++ {
    		DB.Raw("select * from users where id = ?", user.ID).Scan(&u)
    	}
    }
    
    func BenchmarkScanSlice(b *testing.B) {
    	DB.Exec("delete from users")
    	for i := 0; i < 10_000; i++ {
    		user := *GetUser(fmt.Sprintf("scan-%d", i), Config{})
    		DB.Create(&user)
    	}
    
    	var u []User
    	b.ResetTimer()
    	for x := 0; x < b.N; x++ {
    		DB.Raw("select * from users").Scan(&u)
    	}
    }
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Jun 01 03:50:57 GMT 2022
    - 1.5K bytes
    - Viewed (0)
  4. tests/connpool_test.go

    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    			"INSERT INTO `users` (`created_at`,`updated_at`,`deleted_at`,`name`,`age`,`birthday`,`company_id`,`manager_id`,`active`) VALUES (?,?,?,?,?,?,?,?,?)",
    			"SELECT * FROM `users` WHERE name = ? AND `users`.`deleted_at` IS NULL ORDER BY `users`.`id` LIMIT ?",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  5. tests/named_argument_test.go

    	var result5 NamedUser
    	if err := DB.Raw("SELECT * FROM named_users WHERE (name1 = @name AND name3 = @name) AND name2 = @name2", map[string]interface{}{"name": "jinzhu-new", "name2": "jinzhu-new2"}).Find(&result5).Error; err != nil {
    		t.Errorf("failed to update with named arg")
    	}
    
    	AssertEqual(t, result5, namedUser)
    
    	var result6 NamedUser
    	if err := DB.Raw(`SELECT * FROM named_users WHERE (name1 = @name
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Dec 21 11:50:00 GMT 2021
    - 2.7K bytes
    - Viewed (0)
  6. callbacks.go

    	c.processor.db.Logger.Warn(context.Background(), "removing callback `%s` from %s\n", name, utils.FileWithLineNum())
    	c.name = name
    	c.remove = true
    	c.processor.callbacks = append(c.processor.callbacks, c)
    	return c.processor.compile()
    }
    
    func (c *callback) Replace(name string, fn func(*DB)) error {
    	c.processor.db.Logger.Info(context.Background(), "replacing callback `%s` from %s\n", name, utils.FileWithLineNum())
    	c.name = name
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 8.6K bytes
    - Viewed (1)
  7. tests/count_test.go

    	if !regexp.MustCompile(`SELECT COUNT\(.name.\) FROM .*users.*`).MatchString(result.Statement.SQL.String()) {
    		t.Fatalf("Build count with select, but got %v", result.Statement.SQL.String())
    	}
    
    	result = dryDB.Table("users").Distinct("name").Count(&count)
    	if !regexp.MustCompile(`SELECT COUNT\(DISTINCT\(.name.\)\) FROM .*users.*`).MatchString(result.Statement.SQL.String()) {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 6.9K bytes
    - Viewed (0)
  8. tests/soft_delete_test.go

    		t.Fatalf("invalid sql generated, got %v", sql)
    	}
    
    	sql = DB.Session(&gorm.Session{DryRun: true}).Table("user u").Select("name").Find(&User{}).Statement.SQL.String()
    	if !regexp.MustCompile(`SELECT .name. FROM user u WHERE .u.\..deleted_at. IS NULL`).MatchString(sql) {
    		t.Errorf("Table with escape character, got %v", sql)
    	}
    
    	if DB.First(&User{}, "name = ?", user.Name).Error == nil {
    		t.Errorf("Can't find a soft deleted record")
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Feb 01 06:40:55 GMT 2023
    - 5.7K bytes
    - Viewed (0)
  9. clause/limit_test.go

    			"SELECT * FROM `users` LIMIT ?",
    			[]interface{}{limit0},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Limit{Offset: 20}},
    			"SELECT * FROM `users` OFFSET ?",
    			[]interface{}{20},
    		},
    		{
    			[]clause.Interface{clause.Select{}, clause.From{}, clause.Limit{Offset: 20}, clause.Limit{Offset: 30}},
    			"SELECT * FROM `users` OFFSET ?",
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 2.3K bytes
    - Viewed (0)
  10. clause/joins.go

    package clause
    
    type JoinType string
    
    const (
    	CrossJoin JoinType = "CROSS"
    	InnerJoin JoinType = "INNER"
    	LeftJoin  JoinType = "LEFT"
    	RightJoin JoinType = "RIGHT"
    )
    
    // Join clause for from
    type Join struct {
    	Type       JoinType
    	Table      Table
    	ON         Where
    	Using      []string
    	Expression Expression
    }
    
    func (join Join) Build(builder Builder) {
    	if join.Expression != nil {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Nov 03 13:03:13 GMT 2022
    - 901 bytes
    - Viewed (0)
Back to top