Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 10 of 10 for SkipHooks (0.17 sec)

  1. gorm.go

    				Mux:      preparedStmt.Mux,
    				Stmts:    preparedStmt.Stmts,
    			}
    		}
    		txConfig.ConnPool = tx.Statement.ConnPool
    		txConfig.PrepareStmt = true
    	}
    
    	if config.SkipHooks {
    		tx.Statement.SkipHooks = true
    	}
    
    	if config.DisableNestedTransaction {
    		txConfig.DisableNestedTransaction = true
    	}
    
    	if !config.NewDB {
    		tx.clone = 2
    	}
    
    	if config.DryRun {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sun Aug 20 11:46:56 GMT 2023
    - 11.6K bytes
    - Viewed (0)
  2. callbacks/update.go

    						if v, ok := selectColumns[field.DBName]; (ok && v) || (!ok && (!restricted || (!stmt.SkipHooks && field.AutoUpdateTime > 0))) {
    							value, isZero := field.ValueOf(stmt.Context, updatingValue)
    							if !stmt.SkipHooks && field.AutoUpdateTime > 0 {
    								if field.AutoUpdateTime == schema.UnixNanosecond {
    									value = stmt.DB.NowFunc().UnixNano()
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Mar 18 05:44:55 GMT 2024
    - 9.4K bytes
    - Viewed (1)
  3. callbacks/preload.go

    						return err
    					}
    				default:
    					return gorm.ErrInvalidData
    				}
    			} else {
    				tx := db.Table("").Session(&gorm.Session{Context: db.Statement.Context, SkipHooks: db.Statement.SkipHooks})
    				tx.Statement.ReflectValue = db.Statement.ReflectValue
    				tx.Statement.Unscoped = db.Statement.Unscoped
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 15 03:20:20 GMT 2024
    - 11.3K bytes
    - Viewed (0)
  4. callbacks/associations.go

    					}
    				}
    
    				if joins.Len() > 0 {
    					db.AddError(db.Session(&gorm.Session{NewDB: true}).Clauses(clause.OnConflict{DoNothing: true}).Session(&gorm.Session{
    						SkipHooks:                db.Statement.SkipHooks,
    						DisableNestedTransaction: true,
    					}).Create(joins.Interface()).Error)
    				}
    			}
    		}
    	}
    }
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Tue Apr 11 03:06:13 GMT 2023
    - 14.3K bytes
    - Viewed (0)
  5. callbacks/delete.go

    	"reflect"
    	"strings"
    
    	"gorm.io/gorm"
    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    func BeforeDelete(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && db.Statement.Schema.BeforeDelete {
    		callMethod(db, func(value interface{}, tx *gorm.DB) bool {
    			if i, ok := value.(BeforeDeleteInterface); ok {
    				db.AddError(i.BeforeDelete(tx))
    				return true
    			}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Feb 25 02:48:23 GMT 2022
    - 5.6K bytes
    - Viewed (0)
  6. statement.go

    		ConnPool:             stmt.ConnPool,
    		Schema:               stmt.Schema,
    		Context:              stmt.Context,
    		RaiseErrorOnNotFound: stmt.RaiseErrorOnNotFound,
    		SkipHooks:            stmt.SkipHooks,
    	}
    
    	if stmt.SQL.Len() > 0 {
    		newStmt.SQL.WriteString(stmt.SQL.String())
    		newStmt.Vars = make([]interface{}, 0, len(stmt.Vars))
    		newStmt.Vars = append(newStmt.Vars, stmt.Vars...)
    	}
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 19.8K bytes
    - Viewed (0)
  7. tests/hooks_test.go

    	DB.Model(&product).Session(&gorm.Session{SkipHooks: true}).Updates(Product3{Code: "L1216"})
    	if product.Price != 320 || product.Code != "L1216" {
    		t.Errorf("invalid data after update, got %+v", product)
    	}
    
    	var result2 Product3
    	DB.First(&result2, product.ID)
    
    	AssertEqual(t, result2, product)
    
    	product2 := Product3{Name: "Product", Price: 0}
    	DB.Session(&gorm.Session{SkipHooks: true}).Create(&product2)
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Sat Feb 18 01:20:29 GMT 2023
    - 15.9K bytes
    - Viewed (0)
  8. callbacks/create.go

    	"gorm.io/gorm/clause"
    	"gorm.io/gorm/schema"
    	"gorm.io/gorm/utils"
    )
    
    // BeforeCreate before create hooks
    func BeforeCreate(db *gorm.DB) {
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && (db.Statement.Schema.BeforeSave || db.Statement.Schema.BeforeCreate) {
    		callMethod(db, func(value interface{}, tx *gorm.DB) (called bool) {
    			if db.Statement.Schema.BeforeSave {
    				if i, ok := value.(BeforeSaveInterface); ok {
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Apr 08 03:29:55 GMT 2024
    - 12.5K bytes
    - Viewed (0)
  9. finisher_api.go

    	tx = db.getInstance()
    	tx.Statement.Dest = map[string]interface{}{column: value}
    	tx.Statement.SkipHooks = true
    	return tx.callbacks.Update().Execute(tx)
    }
    
    func (db *DB) UpdateColumns(values interface{}) (tx *DB) {
    	tx = db.getInstance()
    	tx.Statement.Dest = values
    	tx.Statement.SkipHooks = true
    	return tx.callbacks.Update().Execute(tx)
    }
    
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Fri Jan 12 08:42:21 GMT 2024
    - 22.7K bytes
    - Viewed (0)
  10. callbacks/query.go

    	}
    }
    
    func AfterQuery(db *gorm.DB) {
    	// clear the joins after query because preload need it
    	db.Statement.Joins = nil
    	if db.Error == nil && db.Statement.Schema != nil && !db.Statement.SkipHooks && db.Statement.Schema.AfterFind && db.RowsAffected > 0 {
    		callMethod(db, func(value interface{}, tx *gorm.DB) bool {
    			if i, ok := value.(AfterFindInterface); ok {
    				db.AddError(i.AfterFind(tx))
    				return true
    Go
    - Registered: Sun Apr 21 09:35:09 GMT 2024
    - Last Modified: Mon Jan 29 03:34:57 GMT 2024
    - 9.9K bytes
    - Viewed (0)
Back to top