change callback names

This commit is contained in:
Jinzhu 2014-01-29 10:28:20 +08:00
parent e2897f0c9b
commit b713479174
4 changed files with 24 additions and 24 deletions

View File

@ -63,12 +63,12 @@ func AfterCreate(scope *Scope) {
}
func init() {
DefaultCallback.Create().Register("begin_transaction", BeginTransaction)
DefaultCallback.Create().Register("before_create", BeforeCreate)
DefaultCallback.Create().Register("save_before_associations", SaveBeforeAssociations)
DefaultCallback.Create().Register("update_time_stamp_when_create", UpdateTimeStampWhenCreate)
DefaultCallback.Create().Register("create", Create)
DefaultCallback.Create().Register("save_after_associations", SaveAfterAssociations)
DefaultCallback.Create().Register("after_create", AfterCreate)
DefaultCallback.Create().Register("commit_or_rollback_transaction", CommitOrRollbackTransaction)
DefaultCallback.Create().Register("gorm:begin_transaction", BeginTransaction)
DefaultCallback.Create().Register("gorm:before_create", BeforeCreate)
DefaultCallback.Create().Register("gorm:save_before_associations", SaveBeforeAssociations)
DefaultCallback.Create().Register("gorm:update_time_stamp_when_create", UpdateTimeStampWhenCreate)
DefaultCallback.Create().Register("gorm:create", Create)
DefaultCallback.Create().Register("gorm:save_after_associations", SaveAfterAssociations)
DefaultCallback.Create().Register("gorm:after_create", AfterCreate)
DefaultCallback.Create().Register("gorm:commit_or_rollback_transaction", CommitOrRollbackTransaction)
}

View File

@ -33,9 +33,9 @@ func AfterDelete(scope *Scope) {
}
func init() {
DefaultCallback.Delete().Register("begin_transaction", BeginTransaction)
DefaultCallback.Delete().Register("before_delete", BeforeDelete)
DefaultCallback.Delete().Register("delete", Delete)
DefaultCallback.Delete().Register("after_delete", AfterDelete)
DefaultCallback.Delete().Register("commit_or_rollback_transaction", CommitOrRollbackTransaction)
DefaultCallback.Delete().Register("gorm:begin_transaction", BeginTransaction)
DefaultCallback.Delete().Register("gorm:before_delete", BeforeDelete)
DefaultCallback.Delete().Register("gorm:delete", Delete)
DefaultCallback.Delete().Register("gorm:after_delete", AfterDelete)
DefaultCallback.Delete().Register("gorm:commit_or_rollback_transaction", CommitOrRollbackTransaction)
}

View File

@ -72,6 +72,6 @@ func AfterQuery(scope *Scope) {
}
func init() {
DefaultCallback.Query().Register("query", Query)
DefaultCallback.Query().Register("after_query", AfterQuery)
DefaultCallback.Query().Register("gorm:query", Query)
DefaultCallback.Query().Register("gorm:after_query", AfterQuery)
}

View File

@ -78,13 +78,13 @@ func AfterUpdate(scope *Scope) {
}
func init() {
DefaultCallback.Update().Register("assign_update_attributes", AssignUpdateAttributes)
DefaultCallback.Update().Register("begin_transaction", BeginTransaction)
DefaultCallback.Update().Register("before_update", BeforeUpdate)
DefaultCallback.Update().Register("save_before_associations", SaveBeforeAssociations)
DefaultCallback.Update().Register("update_time_stamp_when_update", UpdateTimeStampWhenUpdate)
DefaultCallback.Update().Register("update", Update)
DefaultCallback.Update().Register("save_after_associations", SaveAfterAssociations)
DefaultCallback.Update().Register("after_update", AfterUpdate)
DefaultCallback.Update().Register("commit_or_rollback_transaction", CommitOrRollbackTransaction)
DefaultCallback.Update().Register("gorm:assign_update_attributes", AssignUpdateAttributes)
DefaultCallback.Update().Register("gorm:begin_transaction", BeginTransaction)
DefaultCallback.Update().Register("gorm:before_update", BeforeUpdate)
DefaultCallback.Update().Register("gorm:save_before_associations", SaveBeforeAssociations)
DefaultCallback.Update().Register("gorm:update_time_stamp_when_update", UpdateTimeStampWhenUpdate)
DefaultCallback.Update().Register("gorm:update", Update)
DefaultCallback.Update().Register("gorm:save_after_associations", SaveAfterAssociations)
DefaultCallback.Update().Register("gorm:after_update", AfterUpdate)
DefaultCallback.Update().Register("gorm:commit_or_rollback_transaction", CommitOrRollbackTransaction)
}