July 2019
Intermediate to advanced
502 pages
14h
English
The news manager was subscribed to link events by the NewNewsManager() function, and the result is that those events will arrive as calls on OnLinkAdded() and OnlinkUpdated() (delete link events are ignored). The news manager creates an Event object that's defined in the abstract object model, populates it with EventType, Username, Url, and Timestamp, and then calls the event store's AddEvent() function. Here is the OnLinkAdded() method:
func (m *NewsManager) OnLinkAdded(username string, link *om.Link) {
event := &om.Event{
EventType: om.LinkAdded,
Username: username,
Url: link.Url,
Timestamp: time.Now().UTC(),
}
m.eventStore.AddEvent(username, event)
}
Here is the OnLinkUpdated() method:
func (m *NewsManager) OnLinkUpdated(username ...