Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 17 for Sall (1.62 sec)

  1. callbacks.go

    }
    
    func (cs *callbacks) Row() *processor {
    	return cs.processors["row"]
    }
    
    func (cs *callbacks) Raw() *processor {
    	return cs.processors["raw"]
    }
    
    func (p *processor) Execute(db *DB) *DB {
    	// call scopes
    	for len(db.Statement.scopes) > 0 {
    		db = db.executeScopes()
    	}
    
    	var (
    		curTime           = time.Now()
    		stmt              = db.Statement
    		resetBuildClauses bool
    	)
    
    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)
  2. tests/joins_test.go

    	sort.Slice(results, func(i, j int) bool {
    		return user.Pets[i].ID > user.Pets[j].ID
    	})
    
    	if len(results) != 2 || results[0].Name != user.Pets[0].Name || results[1].Name != user.Pets[1].Name {
    		t.Errorf("Should find all two pets with Join select, got %+v", results)
    	}
    }
    
    func TestJoinWithOmit(t *testing.T) {
    	user := *GetUser("joins_with_omit", Config{Pets: 2})
    	DB.Save(&user)
    
    	results := make([]*User, 0)
    
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 26 14:19:32 GMT 2023
    - 13.5K bytes
    - Viewed (1)
  3. tests/connpool_test.go

    //	func (c *wrapperConnPool) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error) {
    //		 return c.db.BeginTx(ctx, opts)
    //	}
    //
    // You should use BeginTx returned gorm.Tx which could wrap *sql.Tx then you can record all queries.
    func (c *wrapperConnPool) BeginTx(ctx context.Context, opts *sql.TxOptions) (gorm.ConnPool, error) {
    	tx, err := c.db.BeginTx(ctx, opts)
    	if err != nil {
    		return nil, err
    	}
    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)
  4. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  5. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Mon Mar 18 11:24:16 GMT 2024
    - 56.2K 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 May 05 09:35:13 GMT 2024
    - Last Modified: Thu Mar 28 08:47:39 GMT 2024
    - 6.4K bytes
    - Viewed (0)
  7. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Wed Apr 17 03:38:55 GMT 2024
    - 14.3K bytes
    - Viewed (1)
  8. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 3.3K bytes
    - Viewed (0)
  9. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Tue Mar 26 03:33:36 GMT 2024
    - 7.2K bytes
    - Viewed (0)
  10. 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 May 05 09:35:13 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
Back to top