diff options
Diffstat (limited to 'internal/events/node.go')
-rw-r--r-- | internal/events/node.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/events/node.go b/internal/events/node.go index a1d9c3e..62d45dd 100644 --- a/internal/events/node.go +++ b/internal/events/node.go @@ -3,17 +3,17 @@ package events import ( "sync" - "go.neonxp.dev/djson/internal/model" + "go.neonxp.dev/djson/internal/command" ) type subscriberNode struct { parent *subscriberNode children map[string]*subscriberNode - channels map[string]chan model.Mutation + channels map[string]chan command.Mutation mu sync.RWMutex } -func (sn *subscriberNode) subscribe(path []string, id string, ch chan model.Mutation) { +func (sn *subscriberNode) subscribe(path []string, id string, ch chan command.Mutation) { sn.mu.Lock() defer sn.mu.Unlock() if len(path) == 0 { @@ -26,7 +26,7 @@ func (sn *subscriberNode) subscribe(path []string, id string, ch chan model.Muta child = &subscriberNode{ parent: sn, children: make(map[string]*subscriberNode), - channels: make(map[string]chan model.Mutation), + channels: make(map[string]chan command.Mutation), } sn.children[head] = child } @@ -51,11 +51,11 @@ func (sn *subscriberNode) unsubscribe(path []string, id string) { } } -func (sn *subscriberNode) notify(path []string, event *model.Mutation) { +func (sn *subscriberNode) notify(path []string, event *command.Mutation) { sn.mu.RLock() defer sn.mu.RUnlock() for _, ch := range sn.channels { - go func(ch chan model.Mutation) { + go func(ch chan command.Mutation) { ch <- *event }(ch) } |