Skip to content

Commit

Permalink
Add Clear function
Browse files Browse the repository at this point in the history
  • Loading branch information
kolsa committed Apr 12, 2019
1 parent f63b4ea commit 8b2f1e8
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions clearing.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package decs

func (cbus *CommandBus) Reset() {
cbus.Clear()
cbus.Filters = cbus.Filters[:0]
cbus.defs = make(map[string]*CommandDefinition)
cbus.guards = make(map[string][]Guard)
cbus.handlers = make(map[string]func(Command, Delegate, ResultNotifier))
cbus.undoHandlers = make(map[string]func(Command, Delegate))

}

func (cbus *CommandBus) Clear() {
cbus.publishingSuspended = false
cbus.cachingSuspended = false
cbus.undoables = cbus.undoables[:0]
cbus.redoables = cbus.redoables[:0]
cbus.flows = make(map[string][]*command)
cbus.Recorder.record.Clear()
cbus.store.Clear()
}

0 comments on commit 8b2f1e8

Please sign in to comment.