Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for BeginTx (0.18 sec)

  1. tests/connpool_test.go

    	return c.db.Ping()
    }
    
    // If you use BeginTx returned *sql.Tx as shown below then you can't record queries in a transaction.
    //
    //	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.
    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)
  2. interfaces.go

    	SavePoint(tx *DB, name string) error
    	RollbackTo(tx *DB, name string) error
    }
    
    // TxBeginner tx beginner
    type TxBeginner interface {
    	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
    }
    
    // ConnPoolBeginner conn pool beginner
    type ConnPoolBeginner interface {
    	BeginTx(ctx context.Context, opts *sql.TxOptions) (ConnPool, error)
    }
    
    // TxCommitter tx committer
    type TxCommitter interface {
    	Commit() error
    Go
    - Registered: Sun May 05 09:35:13 GMT 2024
    - Last Modified: Sat Aug 19 13:33:31 GMT 2023
    - 2.2K bytes
    - Viewed (0)
  3. prepare_stmt.go

    	db.PreparedSQL = append(db.PreparedSQL, query)
    	db.Mux.Unlock()
    
    	return cacheStmt, nil
    }
    
    func (db *PreparedStmtDB) BeginTx(ctx context.Context, opt *sql.TxOptions) (ConnPool, error) {
    	if beginner, ok := db.ConnPool.(TxBeginner); ok {
    		tx, err := beginner.BeginTx(ctx, opt)
    		return &PreparedStmtTX{PreparedStmtDB: db, Tx: tx}, err
    	}
    
    	beginner, ok := db.ConnPool.(ConnPoolBeginner)
    	if !ok {
    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)
  4. finisher_api.go

    	if len(opts) > 0 {
    		opt = opts[0]
    	}
    
    	switch beginner := tx.Statement.ConnPool.(type) {
    	case TxBeginner:
    		tx.Statement.ConnPool, err = beginner.BeginTx(tx.Statement.Context, opt)
    	case ConnPoolBeginner:
    		tx.Statement.ConnPool, err = beginner.BeginTx(tx.Statement.Context, opt)
    	default:
    		err = ErrInvalidTransaction
    	}
    
    	if err != nil {
    		tx.AddError(err)
    	}
    
    	return tx
    }
    
    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)
Back to top