statsd

package module
v0.0.0-...-a85e8f0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: MIT Imports: 3 Imported by: 0

README

statsd

The goal of this project is to collect various data points in a Slack org and post them every month for people to see.

Tracked metrics:

  • member with the most likes received
  • member with the most dislikes received

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalid = errors.New("invalid")
View Source
var ErrNotFound = errors.New("not found")

Application error codes.

Functions

This section is empty.

Types

type Leaderboard

type Leaderboard struct {
	Date                       MonthYear
	MostReceivedLikesMember    Member
	MostReceivedDislikesMember Member
}

Leaderboard represents the Slack user(s) with the most likes and dislikes for a particular month in a given year.

type LeaderboardService

type LeaderboardService interface {
	// FindLeaderboard retrives a Leadboard by its date (year and month).
	// Returns ErrNotFound if no matches are found.
	FindLeaderboard(Date MonthYear) (*Leaderboard, error)
}

LeaderboardService represents a service for managing a Leaderboard.

type Member

type Member struct {
	ID               int       `json:"id"`
	Date             MonthYear `json:"date"`
	SlackUID         string    `json:"slackUID"`
	ReceivedLikes    int       `json:"receivedLikes"`
	ReceivedDislikes int       `json:"receivedDislikes"`
	CreatedAt        time.Time `json:"createdAt"`
	UpdatedAt        time.Time `jons:"updatedAt"`
}

Member represents reactions pertaining to a particular member of the slack organization within a given month and year.

func (*Member) Validate

func (m *Member) Validate() error

Validate returns an error if the member contains invalid fields. This only performs basic validation.

type MemberService

type MemberService interface {
	// FindMemberByID retrieves a Member by ID.
	// Returns ErrNotFound if the ID does not exist.
	FindMemberByID(id int) (*Member, error)

	// FindMember retrives a Member by his Slack User ID, and date (month and year).
	// Returns ErrNotFound if no matches found.
	FindMember(SlackUID string, date MonthYear) (*Member, error)

	// CreateMember creates a new Member.
	CreateMember(m *Member) error

	// UpdateMember updates a Member.
	// Returns ErrNotFound if the member does not exist.
	UpdateMember(id int, upd MemberUpdate) (*Member, error)

	// DeleteMember permanently deletes a Member
	DeleteMember(id int) error
}

MemberService represents a service for managing a Member.

type MemberUpdate

type MemberUpdate struct {
	ReceivedLikes    *int
	ReceivedDislikes *int
}

MemberUpdate represents a set of fields to be updated via UpdateMember().

type MonthYear

type MonthYear string

MonthYear represents a string with the following format: <month>-<year>. I.e. `02-2024` represents February 2024.

func NewMonthYear

func NewMonthYear(t time.Time) MonthYear

NewMonthYear returns a new instance of MonthYear.

func NewMonthYearString

func NewMonthYearString(s string) (MonthYear, error)

NewMonthYearString returns a new instance of MonthYear.

func (*MonthYear) Month

func (my *MonthYear) Month() (string, error)

Month returns the English name of the corresponding month.

func (*MonthYear) String

func (my *MonthYear) String() string

String returns the string representation of MonthYear.

Directories

Path Synopsis
cmd
gen

Jump to

Keyboard shortcuts

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