MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / Initialize

Method Initialize

integrations/gorm/plugin.go:77–84  ·  view source on GitHub ↗

Initialize implements gorm.Plugin by registering after-callbacks.

(db *gorm.DB)

Source from the content-addressed store, hash-verified

75
76// Initialize implements gorm.Plugin by registering after-callbacks.
77func (p *Plugin) Initialize(db *gorm.DB) error {
78 db.Callback().Query().After("gorm:query").Register("gosqlx:after_query", p.afterStatement)
79 db.Callback().Create().After("gorm:create").Register("gosqlx:after_create", p.afterStatement)
80 db.Callback().Update().After("gorm:update").Register("gosqlx:after_update", p.afterStatement)
81 db.Callback().Delete().After("gorm:delete").Register("gosqlx:after_delete", p.afterStatement)
82 db.Callback().Raw().After("gorm:raw").Register("gosqlx:after_raw", p.afterStatement)
83 return nil
84}
85
86func (p *Plugin) afterStatement(db *gorm.DB) {
87 // Guard against nil Statement — this can happen during initialization callbacks.

Callers 1

newInProcessClientFunction · 0.80

Calls 1

UpdateMethod · 0.80

Tested by 1

newInProcessClientFunction · 0.64