Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 50 for TX (0.17 sec)

  1. gorm.go

    func (db *DB) Debug() (tx *DB) {
    	tx = db.getInstance()
    	return tx.Session(&Session{
    		Logger: db.Logger.LogMode(logger.Info),
    	})
    }
    
    // Set store value with key into current db instance's context
    func (db *DB) Set(key string, value interface{}) *DB {
    	tx := db.getInstance()
    	tx.Statement.Settings.Store(key, value)
    	return tx
    }
    
    // Get get value with key from current db instance's context
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  2. finisher_api.go

    	tx := db.getInstance().Set("rows", false)
    	tx = tx.callbacks.Row().Execute(tx)
    	row, ok := tx.Statement.Dest.(*sql.Row)
    	if !ok && tx.DryRun {
    		db.Logger.Error(tx.Statement.Context, ErrDryRunModeUnsupported.Error())
    	}
    	return row
    }
    
    func (db *DB) Rows() (*sql.Rows, error) {
    	tx := db.getInstance().Set("rows", true)
    	tx = tx.callbacks.Row().Execute(tx)
    	rows, ok := tx.Statement.Dest.(*sql.Rows)
    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)
  3. association.go

    		modelValue = reflect.New(association.Relationship.FieldSchema.ModelType).Interface()
    		tx         = association.DB.Model(modelValue)
    	)
    
    	if association.Relationship.JoinTable != nil {
    		if !tx.Statement.Unscoped && len(association.Relationship.JoinTable.QueryClauses) > 0 {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu May 04 11:30:45 GMT 2023
    - 21.2K bytes
    - Viewed (0)
  4. prepare_stmt.go

    		return tx.Tx.Rollback()
    	}
    	return ErrInvalidTransaction
    }
    
    func (tx *PreparedStmtTX) ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error) {
    	stmt, err := tx.PreparedStmtDB.prepare(ctx, tx.Tx, true, query)
    	if err == nil {
    		result, err = tx.Tx.StmtContext(ctx, stmt.Stmt).ExecContext(ctx, args...)
    		if errors.Is(err, driver.ErrBadConn) {
    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)
  5. tests/prepared_stmt_test.go

    	}
    
    	if err := tx.Where("name=?", "zzjin").Delete(&User{}).Error; err != nil {
    		tx.Rollback()
    		t.Errorf("Failed to run one transaction, got error %v\n", err)
    	}
    
    	if err := tx.Create(&User{Name: "zzjin"}).Error; err != nil {
    		tx.Rollback()
    		t.Errorf("Failed to run one transaction, got error %v\n", err)
    	}
    
    	if err := tx.Commit().Error; err != nil {
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Mar 21 07:55:43 GMT 2024
    - 4K bytes
    - Viewed (0)
  6. tests/transaction_test.go

    	if err := tx.Save(&user1).Error; err != nil {
    		t.Fatalf("No error should raise, but got %v", err)
    	}
    
    	if err := tx.First(&User{}, "name = ?", user1.Name).Error; err != nil {
    		t.Fatalf("Should find saved record, but got %v", err)
    	}
    
    	if sqlTx, ok := tx.Statement.ConnPool.(gorm.TxCommitter); !ok || sqlTx == nil {
    		t.Fatalf("Should return the underlying sql.Tx")
    	}
    
    	tx.Rollback()
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Jun 10 13:05:19 GMT 2023
    - 10.9K bytes
    - Viewed (0)
  7. chainable_api.go

    func (db *DB) Select(query interface{}, args ...interface{}) (tx *DB) {
    	tx = db.getInstance()
    
    	switch v := query.(type) {
    	case []string:
    		tx.Statement.Selects = v
    
    		for _, arg := range args {
    			switch arg := arg.(type) {
    			case string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg)
    			case []string:
    				tx.Statement.Selects = append(tx.Statement.Selects, arg...)
    			default:
    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)
  8. tests/sql_builder_test.go

    	user.UpdatedAt = date
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).Updates(user)
    	})
    	assertEqualSQL(t, `UPDATE "users" SET "created_at"='2021-10-18 00:00:00',"updated_at"='2021-10-18 19:50:09.438',"name"='bar',"age"=22 WHERE id = 100 AND "users"."deleted_at" IS NULL`, sql)
    
    	// update
    	sql = DB.ToSQL(func(tx *gorm.DB) *gorm.DB {
    		return tx.Model(&User{}).Where("id = ?", 100).Update("name", "Foo bar")
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 16.7K bytes
    - Viewed (0)
  9. tests/connpool_test.go

    	if err = tx.Save(&user1).Error; err != nil {
    		t.Fatalf("No error should raise, but got %v", err)
    	}
    
    	if err = tx.First(&User{}, "name = ?", user1.Name).Error; err != nil {
    		t.Fatalf("Should find saved record, but got %v", err)
    	}
    
    	if sqlTx, ok := tx.Statement.ConnPool.(gorm.TxCommitter); !ok || sqlTx == nil {
    		t.Fatalf("Should return the underlying sql.Tx")
    	}
    
    	tx.Rollback()
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Tue Feb 06 02:54:40 GMT 2024
    - 5.5K bytes
    - Viewed (0)
  10. callbacks/delete.go

    				queryConds := rel.ToQueryConditions(db.Statement.Context, db.Statement.ReflectValue)
    				modelValue := reflect.New(rel.FieldSchema.ModelType).Interface()
    				tx := db.Session(&gorm.Session{NewDB: true}).Model(modelValue)
    				withoutConditions := false
    				if db.Statement.Unscoped {
    					tx = tx.Unscoped()
    				}
    
    				if len(db.Statement.Selects) > 0 {
    					selects := make([]string, 0, len(db.Statement.Selects))
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
Back to top