Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for InstanceGet (0.21 sec)

  1. callbacks/transaction.go

    			db.Statement.ConnPool = tx.Statement.ConnPool
    			db.InstanceSet("gorm:started_transaction", true)
    		} else if tx.Error == gorm.ErrInvalidTransaction {
    			tx.Error = nil
    		} else {
    			db.Error = tx.Error
    		}
    	}
    }
    
    func CommitOrRollbackTransaction(db *gorm.DB) {
    	if !db.Config.SkipDefaultTransaction {
    		if _, ok := db.InstanceGet("gorm:started_transaction"); ok {
    			if db.Error != nil {
    				db.Rollback()
    Go
    - Registered: Sun Apr 28 09:35:09 GMT 2024
    - Last Modified: Mon Nov 29 01:33:20 GMT 2021
    - 675 bytes
    - Viewed (0)
  2. gorm.go

    	return db.Statement.Settings.Load(key)
    }
    
    // InstanceSet store value with key into current db instance's context
    func (db *DB) InstanceSet(key string, value interface{}) *DB {
    	tx := db.getInstance()
    	tx.Statement.Settings.Store(fmt.Sprintf("%p", tx.Statement)+key, value)
    	return tx
    }
    
    // InstanceGet get value with key from current db instance's context
    func (db *DB) InstanceGet(key string) (interface{}, bool) {
    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)
Back to top