justscored

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2018 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package justscored contains shared DynamoDB code used by goal-checker and goal-notifier Lambda functions.

Index

Constants

View Source
const (
	Away = "away"
	Home = "home"
)

Variables

This section is empty.

Functions

func AddGoal

func AddGoal(goal *Goal) error

AddGoal adds passed goal to DynamoDB

func AddGoals

func AddGoals(goals []*Goal) (addedGoals int)

AddGoals adds passed goals to DynamoDB

Types

type Goal

type Goal struct {
	EventID int // e.g. 123 (Hash Key)

	Player     string // e.g. "Bender RODRIGUEZ"
	PlayerTeam string // "home" or "away"
	GoalTime   string // e.g. "90'+2'"
	GoalType   string // "goal", "goal-penalty" or "goal-own"

	MatchID  string
	AwayTeam map[string]interface{}
	HomeTeam map[string]interface{}

	CreatedAt          time.Time
	Processed          bool
	NotificationSentAt interface{} // time.Time if sent, nil otherwise
}

Goal holds all relevant World Cup goal information, based on worldcup.Match and worldcup.TeamEvent structure

func GetMatchGoals

func GetMatchGoals(match *worldcup.Match) (goals []*Goal)

GetMatchGoals parses passed worldcup.Match and returns a list of its goals

func (Goal) GetTeamInfo added in v0.0.7

func (goal Goal) GetTeamInfo(team string) *map[string]interface{}

GetTeamInfo returns scorer team info

func (Goal) SetDBValue added in v0.0.6

func (goal Goal) SetDBValue(field string, value interface{}) error

SetDBValue updates goal DynamoDB field with passed value

func (Goal) ToSlackMessage added in v0.0.6

func (goal Goal) ToSlackMessage() string

ToSlackMessage formats goal data to a Slack compatible string format

Jump to

Keyboard shortcuts

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