Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CountViews ¶
func CountViews(sqsEvent events.SQSEvent) (map[string]ProcessedEvent, error)
CountViews totals the number of views for each article It processes the sum of each article viewed by implementing a set using Go map and does parallel data processing
Types ¶
type ProcessedEvent ¶
type ProcessedEvent struct { ArticleID string ArticleTitle string UniqueViews int TotalViews int // sum total of all views unique or not }
ProcessedEvent is the result returned after counting
func GetCountedPosts ¶
func GetCountedPosts(data map[string]ProcessedEvent) []ProcessedEvent
GetCountedPosts iterates over a map of articles and retrieves the Articles Returns a slice of Article items with updated stats
Click to show internal directories.
Click to hide internal directories.