process

package
v0.0.0-...-e984984 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2021 License: MIT Imports: 3 Imported by: 0

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL