Implement store.Push(k, op)
This commit is contained in:
Binary file not shown.
@@ -10,6 +10,16 @@ func NewStore() *Store {
|
|||||||
return &store
|
return &store
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (store *Store) Push(k string, op Event) {
|
||||||
|
event, ok := store.Get(k)
|
||||||
|
if ok {
|
||||||
|
event = event.Push(op)
|
||||||
|
} else {
|
||||||
|
event = op
|
||||||
|
}
|
||||||
|
store.Set(k, event)
|
||||||
|
}
|
||||||
|
|
||||||
func (store *Store) Set(k string, v Event) {
|
func (store *Store) Set(k string, v Event) {
|
||||||
(*sync.Map)(store).Store(k, v)
|
(*sync.Map)(store).Store(k, v)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user