@@ -19,42 +19,10 @@ import (
1919 "github.com/chenmingyong0423/go-mongox/operation"
2020)
2121
22- func RegisterBeforeInsert (name string , cb callback.CbFn ) {
23- callback .Callbacks .Register (operation . OpTypeBeforeInsert , name , cb )
22+ func Register (name string , cb callback.CbFn , opType operation. OpType ) {
23+ callback .Callbacks .Register (opType , name , cb )
2424}
2525
26- func RegisterAfterInsert (name string , cb callback.CbFn ) {
27- callback .Callbacks .Register (operation .OpTypeAfterInsert , name , cb )
28- }
29-
30- func RegisterBeforeUpdate (name string , cb callback.CbFn ) {
31- callback .Callbacks .Register (operation .OpTypeBeforeUpdate , name , cb )
32- }
33-
34- func RegisterAfterUpdate (name string , cb callback.CbFn ) {
35- callback .Callbacks .Register (operation .OpTypeAfterUpdate , name , cb )
36- }
37-
38- func RegisterBeforeDelete (name string , cb callback.CbFn ) {
39- callback .Callbacks .Register (operation .OpTypeBeforeDelete , name , cb )
40- }
41-
42- func RegisterAfterDelete (name string , cb callback.CbFn ) {
43- callback .Callbacks .Register (operation .OpTypeAfterDelete , name , cb )
44- }
45-
46- func RegisterBeforeUpsert (name string , cb callback.CbFn ) {
47- callback .Callbacks .Register (operation .OpTypeBeforeUpsert , name , cb )
48- }
49-
50- func RegisterAfterUpsert (name string , cb callback.CbFn ) {
51- callback .Callbacks .Register (operation .OpTypeAfterUpsert , name , cb )
52- }
53-
54- func RegisterBeforeFind (name string , cb callback.CbFn ) {
55- callback .Callbacks .Register (operation .OpTypeBeforeFind , name , cb )
56- }
57-
58- func RegisterAfterFind (name string , cb callback.CbFn ) {
59- callback .Callbacks .Register (operation .OpTypeAfterFind , name , cb )
26+ func Remove (name string , opType operation.OpType ) {
27+ callback .Callbacks .Remove (opType , name )
6028}
0 commit comments