Search Options

Results per page
Sort
Preferred Languages
Advance

Results 31 - 40 of 60 for results (0.15 sec)

  1. schema/naming.go

    	return ret
    }
    
    func (ns NamingStrategy) toSchemaName(name string) string {
    	result := strings.ReplaceAll(strings.Title(strings.ReplaceAll(name, "_", " ")), " ", "")
    	for _, initialism := range commonInitialisms {
    		result = regexp.MustCompile(strings.Title(strings.ToLower(initialism))+"([A-Z]|$|_)").ReplaceAllString(result, initialism+"$1")
    	}
    	return result
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Oct 30 09:15:49 GMT 2023
    - 5.2K bytes
    - Viewed (0)
  2. tests/scopes_test.go

    	if db.Find(&User{}).Statement.Table != "custom_table" {
    		t.Errorf("failed to call Scopes")
    	}
    
    	result := DB.Scopes(NameIn1And2, func(tx *gorm.DB) *gorm.DB {
    		return tx.Session(&gorm.Session{})
    	}).Find(&users1)
    
    	if result.RowsAffected != 2 {
    		t.Errorf("Should found two users's name in 1, 2, but got %v", result.RowsAffected)
    	}
    
    	var maxId int64
    	userTable := func(db *gorm.DB) *gorm.DB {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  3. statement.go

    				results[rel.Name] = result
    			}
    		} else if field := stmt.Schema.LookUpField(column); field != nil && field.DBName != "" {
    			results[field.DBName] = result
    		} else if table, col := matchName(column); col != "" && (table == stmt.Table || table == "") {
    			if col == "*" {
    				for _, dbName := range stmt.Schema.DBNames {
    					results[dbName] = result
    				}
    			} else {
    				results[col] = result
    			}
    		} else {
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  4. clause/returning_test.go

    				[]clause.Column{{Name: "name"}, {Name: "age"}},
    			}},
    			"SELECT * FROM `users` RETURNING `users`.`id`,`name`,`age`", nil,
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    			checkBuildClauses(t, result.Clauses, result.Result, result.Vars)
    		})
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Tue Jun 02 01:18:01 GMT 2020
    - 845 bytes
    - Viewed (0)
  5. tests/group_by_test.go

    	}
    
    	if err := DB.Model(&User{}).Select("name, sum(age) as total").Where("name LIKE ?", "groupby%").Group("name").Having("name = ?", "groupby1").Scan(&result).Error; err != nil {
    		t.Errorf("no error should happen, but got %v", err)
    	}
    
    	if result.Name != "groupby1" || result.Total != 660 {
    		t.Errorf("name should be groupby, total should be 660, but got %+v", result)
    	}
    
    	var active bool
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 3.3K bytes
    - Viewed (0)
  6. finisher_api.go

    		}
    	}
    
    	for {
    		result := queryDB.Limit(batchSize).Find(dest)
    		rowsAffected += result.RowsAffected
    		batch++
    
    		if result.Error == nil && result.RowsAffected != 0 {
    			fcTx := result.Session(&Session{NewDB: true})
    			fcTx.RowsAffected = result.RowsAffected
    			tx.AddError(fc(fcTx, batch))
    		} else if result.Error != nil {
    			tx.AddError(result.Error)
    		}
    
    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)
  7. callbacks/delete.go

    		if !db.DryRun && db.Error == nil {
    			ok, mode := hasReturning(db, supportReturning)
    			if !ok {
    				result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
    				if db.AddError(err) == nil {
    					db.RowsAffected, _ = result.RowsAffected()
    				}
    
    				return
    			}
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  8. callbacks/create.go

    					db.AddError(rows.Close())
    				}()
    				gorm.Scan(rows, db, mode)
    			}
    
    			return
    		}
    
    		result, err := db.Statement.ConnPool.ExecContext(
    			db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...,
    		)
    		if err != nil {
    			db.AddError(err)
    			return
    		}
    
    		db.RowsAffected, _ = result.RowsAffected()
    		if db.RowsAffected == 0 {
    			return
    		}
    
    		var (
    			pkField     *schema.Field
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  9. clause/order_by_test.go

    				},
    			},
    			"SELECT * FROM `users` ORDER BY FIELD(id, ?,?,?)",
    			[]interface{}{1, 2, 3},
    		},
    	}
    
    	for idx, result := range results {
    		t.Run(fmt.Sprintf("case #%v", idx), func(t *testing.T) {
    			checkBuildClauses(t, result.Clauses, result.Result, result.Vars)
    		})
    	}
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Thu Jan 06 07:02:53 GMT 2022
    - 1.6K bytes
    - Viewed (0)
  10. tests/preload_test.go

    		t.Errorf("json marshal is not empty slice, got %v", string(r))
    	}
    
    	var results []User
    	DB.Preload("Team").Preload("Languages").Preload("Friends").Find(&results, "name = ?", user.Name)
    
    	if r, err := json.Marshal(&results); err != nil {
    		t.Errorf("failed to marshal users, got error %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)
Back to top