Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 18 for Ball (0.14 sec)

  1. chainable_api.go

    	db.Statement.scopes = nil
    	for _, scope := range scopes {
    		db = scope(db)
    	}
    	return db
    }
    
    // Preload preload associations with given conditions
    //
    //	// get all users, and preload all non-cancelled orders
    //	db.Preload("Orders", "state NOT IN (?)", "cancelled").Find(&users)
    func (db *DB) Preload(query string, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  2. tests/scopes_test.go

    	db := DB.Scopes(func(tx *gorm.DB) *gorm.DB {
    		return tx.Table("custom_table")
    	}).Session(&gorm.Session{})
    
    	db.AutoMigrate(&User{})
    	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 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  3. tests/callbacks_test.go

    				var argValues []reflect.Value
    				for _, arg := range args {
    					argValues = append(argValues, reflect.ValueOf(arg))
    				}
    
    				results := reflect.ValueOf(s).MethodByName(name).Call(argValues)
    				if len(results) > 0 {
    					v = results[0].Interface()
    				}
    			}
    
    			if c.name == "" {
    				c.name = getFuncName(c.h)
    			}
    
    			if c.before != "" {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  4. tests/hooks_test.go

    		if products[idx].Price != value {
    			t.Errorf("invalid price for product #%v, expects: %v, got %v", idx, value, products[idx].Price)
    		}
    	}
    
    	DB.Model(&products).Update("Name", "product-name")
    
    	// will set all product's price to last product's price + 10
    	for idx, value := range []int64{410, 410, 410} {
    		if products[idx].Price != value {
    			t.Errorf("invalid price for product #%v, expects: %v, got %v", idx, value, products[idx].Price)
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  5. callbacks/associations.go

    	}
    
    	return db.AddError(tx.Create(values).Error)
    }
    
    // check association values has been saved
    // if values kind is Struct, check it has been saved
    // if values kind is Slice/Array, check all items have been saved
    var visitMapStoreKey = "gorm:saved_association_map"
    
    func checkAssociationsSaved(db *gorm.DB, values reflect.Value) bool {
    	if visit, ok := db.Get(visitMapStoreKey); ok {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  6. prepare_stmt.go

    	defer close(cacheStmt.prepared)
    
    	// Reason why cannot lock conn.PrepareContext
    	// suppose the maxopen is 1, g1 is creating record and g2 is querying record.
    	// 1. g1 begin tx, g1 is requeue because of waiting for the system call, now `db.ConnPool` db.numOpen == 1.
    	// 2. g2 select lock `conn.PrepareContext(ctx, query)`, now db.numOpen == db.maxOpen , wait for release.
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  7. finisher_api.go

    					return tx.callbacks.Create().Execute(tx)
    				}
    			}
    		}
    
    		fallthrough
    	default:
    		selectedUpdate := len(tx.Statement.Selects) != 0
    		// when updating, use all fields including those zero-value fields
    		if !selectedUpdate {
    			tx.Statement.Selects = append(tx.Statement.Selects, "*")
    		}
    
    		updateTx := tx.callbacks.Update().Execute(tx.Session(&Session{Initialized: true}))
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  8. tests/migrate_test.go

    		}
    		UniqueStruct6 struct {
    			Name string `gorm:"size:60;uniqueIndex"`
    		}
    		UniqueStruct7 struct {
    			Name     string `gorm:"size:70;uniqueIndex:idx_us6_all_names"`
    			NickName string `gorm:"size:70;uniqueIndex:idx_us6_all_names"`
    		}
    	)
    	checkField(&UniqueStruct5{}, "name", false, "idx_unique_struct5_name")
    	checkField(&UniqueStruct6{}, "name", false, "idx_unique_struct6_name")
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K bytes
    - Viewed (0)
  9. callbacks/helper.go

    	columns := make([]string, 0, len(mapValues))
    
    	// when the length of mapValues is zero,return directly here
    	// no need to call stmt.SelectAndOmitColumns method
    	if len(mapValues) == 0 {
    		stmt.AddError(gorm.ErrEmptySlice)
    		return
    	}
    
    	var (
    		result                    = make(map[string][]interface{}, len(mapValues))
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 14 12:32:57 GMT 2022
    - 3.7K bytes
    - Viewed (0)
  10. tests/joins_table_test.go

    		t.Fatalf("Should found soft deleted addresses with unscoped")
    	}
    
    	DB.Model(&person).Association("Addresses").Clear()
    
    	if DB.Model(&person).Association("Addresses").Count() != 0 {
    		t.Fatalf("Should deleted all addresses")
    	}
    
    	if DB.Unscoped().Model(&person).Association("Addresses").Count() != 2 {
    		t.Fatalf("Should found soft deleted addresses with unscoped")
    	}
    
    	DB.Unscoped().Model(&person).Association("Addresses").Clear()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Sep 10 13:46:18 GMT 2020
    - 3.5K bytes
    - Viewed (0)
Back to top