github.com/HXSecurity/DongTai-agent-go@v0.4.2/core/gorm/gormDBOrder/install.go (about) 1 package gormDBOrder 2 3 import ( 4 "fmt" 5 "github.com/HXSecurity/DongTai-agent-go/model" 6 "github.com/brahma-adshonor/gohook" 7 "gorm.io/gorm" 8 ) 9 10 func init() { 11 model.HookMap["gormDBOrder"] = new(GormDBOrder) 12 } 13 14 type GormDBOrder struct { 15 } 16 17 func (h *GormDBOrder) Hook() { 18 db := &gorm.DB{} 19 err := gohook.HookMethod(db, "Order", Order, OrderT) 20 if err != nil { 21 fmt.Println(err, "gormOrder") 22 } else { 23 fmt.Println("gormOrder") 24 } 25 } 26 27 func (h *GormDBOrder) UnHook() { 28 db := &gorm.DB{} 29 gohook.UnHookMethod(db, "Order") 30 }