report

package
v0.0.0-...-f0644f1 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2018 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewReportService

func NewReportService(rr ReportRepository, logger *log.Logger) *reportService

NewReportService returns a ReportService instance with the dependencies injected

Types

type ChatAnalytics

type ChatAnalytics struct {
	WordsSent    int
	MessagesSent int
	Participants map[string]ParticipantAnalytics
	HourList     Hourlist

	// HourMap is used by the analyzer, it is not stored.
	HourMap map[string]int `json:"-"`
}

ChatAnalytics represents the analytics of the chat

type Hour

type Hour struct {
	Hour     string
	Messages int
}

Hour represents a single hour

type Hourlist

type Hourlist []Hour

Hourlist is a slice of hours that implements the sort interface to sort by hour.

func (Hourlist) Len

func (hl Hourlist) Len() int

func (Hourlist) Less

func (hl Hourlist) Less(i, j int) bool

func (Hourlist) Swap

func (hl Hourlist) Swap(i, j int)

type Month

type Month struct {
	Month    string
	Messages int
}

Month represents a single month

type Monthlist

type Monthlist []Month

Monthlist is a slice of months that implements the sort interface to sort by month

func (Monthlist) Len

func (ml Monthlist) Len() int

func (Monthlist) Less

func (ml Monthlist) Less(i, j int) bool

func (Monthlist) Swap

func (ml Monthlist) Swap(i, j int)

type ParticipantAnalytics

type ParticipantAnalytics struct {
	//Name         string
	WordsSent    int
	MessagesSent int
	WordList     Wordlist
	MonthList    Monthlist

	// These fields are used by the analyzer, they are not stored.
	WordMap  map[string]int `json:"-"`
	MonthMap map[string]int `json:"-"`
}

ParticipantAnalytics represents the analytics for a single participant in a chat

type Report

type Report struct {
	ReportID      string        `json:"ReportID"`
	ChatAnalytics ChatAnalytics `json:"report_analytics"`
}

Report represents an individual report

type ReportRepository

type ReportRepository interface {
	Get(ctx context.Context, id string) (*Report, error)
	Store(*Report) error
}

ReportRepository represents a repository of reports

type ReportService

type ReportService interface {
	Get(ctx context.Context, id string) (*Report, error)
	New(*Report) error
}

ReportService represents a service for interacting with the Report Repository

type Word

type Word struct {
	Word  string
	Usage int
}

Word represents a unique word

type Wordlist

type Wordlist []Word

Wordlist is a slice of words that implements sort interface to sort by count

func (Wordlist) Len

func (wl Wordlist) Len() int

func (Wordlist) Less

func (wl Wordlist) Less(i, j int) bool

func (Wordlist) Swap

func (wl Wordlist) Swap(i, j int)

Jump to

Keyboard shortcuts

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