clone callback when call Callback

This commit is contained in:
Jinzhu 2014-01-29 10:25:58 +08:00
parent 31247c577d
commit e2897f0c9b
2 changed files with 9 additions and 0 deletions

View File

@ -29,6 +29,10 @@ func (c *callback) addProcessor(typ string) *callback_processor {
return cp return cp
} }
func (c *callback) clone() *callback {
return &callback{processors: c.processors}
}
func (c *callback) Create() *callback_processor { func (c *callback) Create() *callback_processor {
return c.addProcessor("create") return c.addProcessor("create")
} }

View File

@ -32,6 +32,11 @@ func (s *DB) DB() *sql.DB {
return s.db.(*sql.DB) return s.db.(*sql.DB)
} }
func (s *DB) Callback() *callback {
s.parent.callback = s.parent.callback.clone()
return s.parent.callback
}
func (s *DB) SetTagIdentifier(str string) { func (s *DB) SetTagIdentifier(str string) {
s.parent.tagIdentifier = str s.parent.tagIdentifier = str
} }