Skip to content

Commit

Permalink
clone callback when call Callback
Browse files Browse the repository at this point in the history
  • Loading branch information
jinzhu committed Jan 29, 2014
1 parent 31247c5 commit e2897f0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions callback.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ func (c *callback) addProcessor(typ string) *callback_processor {
return cp
}

func (c *callback) clone() *callback {
return &callback{processors: c.processors}
}

func (c *callback) Create() *callback_processor {
return c.addProcessor("create")
}
Expand Down
5 changes: 5 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (s *DB) 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) {
s.parent.tagIdentifier = str
}
Expand Down

0 comments on commit e2897f0

Please sign in to comment.