Search Options

Results per page
Sort
Preferred Languages
Advance

Results 21 - 26 of 26 for scwang (0.5 sec)

  1. callbacks/update.go

    					dest := db.Statement.Dest
    					db.Statement.Dest = db.Statement.ReflectValue.Addr().Interface()
    					gorm.Scan(rows, db, mode)
    					db.Statement.Dest = dest
    					db.AddError(rows.Close())
    				}
    			} else {
    				result, err := db.Statement.ConnPool.ExecContext(db.Statement.Context, db.Statement.SQL.String(), db.Statement.Vars...)
    
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Mon Mar 18 05:44:55 UTC 2024
    - 9.4K bytes
    - Viewed (0)
  2. tests/scan_test.go

    	if res.ID != user3.ID || res.Name != user3.Name || res.Age != int(user3.Age) {
    		t.Fatalf("Scan into struct should work, got %#v, should %#v", res, user3)
    	}
    
    	doubleAgeRes := &result{}
    	if err := DB.Table("users").Select("age + age as age").Where("id = ?", user3.ID).Scan(&doubleAgeRes).Error; err != nil {
    		t.Errorf("Scan to pointer of pointer")
    	}
    
    	if doubleAgeRes.Age != int(res.Age)*2 {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed Jun 12 10:57:36 UTC 2024
    - 10.9K bytes
    - Viewed (0)
  3. schema/interfaces.go

    	GetName() string
    	Build() (sql string, vars []interface{})
    }
    
    // GormDataTypeInterface gorm data type interface
    type GormDataTypeInterface interface {
    	GormDataType() string
    }
    
    // FieldNewValuePool field new scan value pool
    type FieldNewValuePool interface {
    	Get() interface{}
    	Put(interface{})
    }
    
    // CreateClausesInterface create clauses interface
    type CreateClausesInterface interface {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Sun Feb 04 07:49:19 UTC 2024
    - 980 bytes
    - Viewed (0)
  4. tests/connection_test.go

    	if len(setSQL) == 0 || len(getSQL) == 0 {
    		return
    	}
    
    	err := DB.Connection(func(tx *gorm.DB) error {
    		if err := tx.Exec(setSQL, expectedName).Error; err != nil {
    			return err
    		}
    
    		if err := tx.Raw(getSQL).Scan(&actualName).Error; err != nil {
    			return err
    		}
    		return nil
    	})
    	if err != nil {
    		t.Errorf(fmt.Sprintf("WithSingleConnection should work, but got err %v", err))
    	}
    
    	if actualName != expectedName {
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 28 14:16:42 UTC 2022
    - 963 bytes
    - Viewed (0)
  5. tests/scopes_test.go

    	}
    
    	var maxId int64
    	userTable := func(db *gorm.DB) *gorm.DB {
    		return db.WithContext(context.Background()).Table("users")
    	}
    	if err := DB.Scopes(userTable).Select("max(id)").Scan(&maxId).Error; err != nil {
    		t.Errorf("select max(id)")
    	}
    }
    
    func TestComplexScopes(t *testing.T) {
    	tests := []struct {
    		name     string
    		queryFn  func(tx *gorm.DB) *gorm.DB
    		expected string
    	}{
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Fri Jan 12 08:42:21 UTC 2024
    - 3.3K bytes
    - Viewed (0)
  6. tests/transaction_test.go

    	DB.Create(&user)
    
    	var err error
    	err = DB.Transaction(func(tx *gorm.DB) error {
    		return tx.Model(&User{}).Limit(1).Transaction(func(tx2 *gorm.DB) error {
    			return tx2.Scan(&User{}).Error
    		})
    	})
    
    	if err != nil {
    		t.Error(err)
    	}
    
    	// method with hooks
    	err = DB.Transaction(func(tx1 *gorm.DB) error {
    		// callMethod do
    Registered: Wed Jun 12 16:27:09 UTC 2024
    - Last Modified: Wed May 08 04:07:58 UTC 2024
    - 10.9K bytes
    - Viewed (0)
Back to top