From b713479174d013550a465c1a866c66e7de954de1 Mon Sep 17 00:00:00 2001 From: Jinzhu Date: Wed, 29 Jan 2014 10:28:20 +0800 Subject: [PATCH] change callback names --- callback_create.go | 16 ++++++++-------- callback_delete.go | 10 +++++----- callback_query.go | 4 ++-- callback_update.go | 18 +++++++++--------- 4 files changed, 24 insertions(+), 24 deletions(-) diff --git a/callback_create.go b/callback_create.go index ea7ddaee..d5e56267 100644 --- a/callback_create.go +++ b/callback_create.go @@ -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) } diff --git a/callback_delete.go b/callback_delete.go index 82e61642..facb853b 100644 --- a/callback_delete.go +++ b/callback_delete.go @@ -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) } diff --git a/callback_query.go b/callback_query.go index e671899f..b59a60a5 100644 --- a/callback_query.go +++ b/callback_query.go @@ -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) } diff --git a/callback_update.go b/callback_update.go index 1b3ceda2..a3c49372 100644 --- a/callback_update.go +++ b/callback_update.go @@ -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) }