Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for AfterFind (0.13 sec)

  1. schema/callbacks_test.go

    			t.Errorf("%v should be true", str)
    		}
    	}
    
    	for _, str := range []string{"BeforeCreate", "BeforeUpdate", "AfterUpdate", "AfterSave", "BeforeDelete", "AfterDelete", "AfterFind"} {
    		if reflect.Indirect(reflect.ValueOf(user)).FieldByName(str).Interface().(bool) {
    			t.Errorf("%v should be false", str)
    		}
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Jan 06 07:02:53 UTC 2022
    - 939 bytes
    - Viewed (0)
  2. tests/hooks_test.go

    }
    
    func (s *Product) BeforeSave(tx *gorm.DB) (err error) {
    	if s.Code == "dont_save" {
    		err = errors.New("can't save")
    	}
    	s.BeforeSaveCallTimes = s.BeforeSaveCallTimes + 1
    	return
    }
    
    func (s *Product) AfterFind(tx *gorm.DB) (err error) {
    	s.AfterFindCallTimes = s.AfterFindCallTimes + 1
    	return
    }
    
    func (s *Product) AfterCreate(tx *gorm.DB) (err error) {
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Mon Jun 17 03:59:06 UTC 2024
    - 16.7K bytes
    - Viewed (0)
  3. callbacks/interfaces.go

    }
    
    type BeforeDeleteInterface interface {
    	BeforeDelete(*gorm.DB) error
    }
    
    type AfterDeleteInterface interface {
    	AfterDelete(*gorm.DB) error
    }
    
    type AfterFindInterface interface {
    	AfterFind(*gorm.DB) error
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 27 07:03:57 UTC 2020
    - 667 bytes
    - Viewed (0)
  4. schema/schema.go

    	callbackTypeAfterSave    callbackType = "AfterSave"
    	callbackTypeBeforeDelete callbackType = "BeforeDelete"
    	callbackTypeAfterDelete  callbackType = "AfterDelete"
    	callbackTypeAfterFind    callbackType = "AfterFind"
    )
    
    // ErrUnsupportedDataType unsupported data type
    var ErrUnsupportedDataType = errors.New("unsupported data type")
    
    type Schema struct {
    	Name                      string
    	ModelType                 reflect.Type
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Jun 20 12:19:31 UTC 2024
    - 13.7K bytes
    - Viewed (0)
  5. callbacks/query.go

    		db.Statement.Clauses["FROM"] = fromClause
    	}
    	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
    			}
    			return false
    		})
    	}
    Registered: Sun Nov 03 09:35:10 UTC 2024
    - Last Modified: Thu Aug 22 11:03:42 UTC 2024
    - 10.1K bytes
    - Viewed (1)
Back to top