change store.Push/Set(k, v) to store.Push/Set(v)

master
Bel LaPointe 2023-10-11 15:48:48 -06:00
parent 0399e10d7d
commit 27ea083084
1 changed files with 5 additions and 3 deletions

View File

@ -10,17 +10,19 @@ func NewStore() *Store {
return &store
}
func (store *Store) Push(k string, op Event) {
func (store *Store) Push(op Event) {
k := op.ID
event, ok := store.Get(k)
if ok {
event = event.Push(op)
} else {
event = op
}
store.Set(k, event)
store.Set(event)
}
func (store *Store) Set(k string, v Event) {
func (store *Store) Set(v Event) {
k := v.ID
(*sync.Map)(store).Store(k, v)
}