Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for committed (0.23 sec)

  1. tests/transaction_test.go

    		t.Fatalf("Should find saved record, but got %v", err)
    	}
    
    	tx2.Commit()
    
    	if err := DB.First(&User{}, "name = ?", "transaction-2").Error; err != nil {
    		t.Fatalf("Should be able to find committed record, but got %v", err)
    	}
    
    	t.Run("this is test nested transaction and prepareStmt coexist case", func(t *testing.T) {
    		// enable prepare statement
    		tx3 := DB.Session(&gorm.Session{PrepareStmt: true})
    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)
  2. finisher_api.go

    func (db *DB) Commit() *DB {
    	if committer, ok := db.Statement.ConnPool.(TxCommitter); ok && committer != nil && !reflect.ValueOf(committer).IsNil() {
    		db.AddError(committer.Commit())
    	} else {
    		db.AddError(ErrInvalidTransaction)
    	}
    	return db
    }
    
    // Rollback rollbacks the changes in a transaction
    func (db *DB) Rollback() *DB {
    	if committer, ok := db.Statement.ConnPool.(TxCommitter); ok && committer != nil {
    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. interfaces.go

    }
    
    // ConnPoolBeginner conn pool beginner
    type ConnPoolBeginner interface {
    	BeginTx(ctx context.Context, opts *sql.TxOptions) (ConnPool, error)
    }
    
    // TxCommitter tx committer
    type TxCommitter interface {
    	Commit() error
    	Rollback() error
    }
    
    // Tx sql.Tx interface
    type Tx interface {
    	ConnPool
    	TxCommitter
    	StmtContext(ctx context.Context, stmt *sql.Stmt) *sql.Stmt
    }
    
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Sat Aug 19 13:33:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  4. tests/connpool_test.go

    		t.Fatalf("Should find saved record, but got %v", err)
    	}
    
    	tx2.Commit()
    
    	if err = db.First(&User{}, "name = ?", "transaction-2").Error; err != nil {
    		t.Fatalf("Should be able to find committed record, but got %v", err)
    	}
    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)
  5. tests/query_test.go

    	if result.ID == 0 {
    		t.Errorf("Should not have ID because only selected name, %+v", result.ID)
    	}
    
    	if result.Name != "" || result.Age != 20 {
    		t.Errorf("User Name should be omitted, got %v, Age should be ok, got %v", result.Name, result.Age)
    	}
    }
    
    func TestOmitWithAllFields(t *testing.T) {
    	user := User{Name: "OmitUser1", Age: 20}
    	DB.Save(&user)
    
    	var userResult User
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Thu Apr 25 12:22:53 GMT 2024
    - 49.8K bytes
    - Viewed (0)
Back to top