award

package
v4.6.2 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2024 License: BSD-3-Clause, MIT, OFL-1.1 Imports: 7 Imported by: 0

Documentation

Overview

Package award defines a MOTH award, and provides tools to use them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type List

type List []T

List is a collection of award events.

func (List) Len

func (awards List) Len() int

Len returns the length of the awards list.

func (List) Less

func (awards List) Less(i, j int) bool

Less returns true if i was awarded before j.

func (List) Swap

func (awards List) Swap(i, j int)

Swap exchanges the awards in positions i and j.

type T

type T struct {
	// Unix epoch time of this event
	When     int64
	TeamID   string
	Category string
	Points   int
}

T represents a single award event.

func Parse

func Parse(s string) (T, error)

Parse parses a string log entry into an award.T.

func (T) Equal

func (a T) Equal(o T) bool

Equal returns true if two award events represent the same award. Timestamps are ignored in this comparison!

func (T) Filename

func (a T) Filename() string

Filename returns a string version of an award suitable for a filesystem

func (T) MarshalJSON

func (a T) MarshalJSON() ([]byte, error)

MarshalJSON returns the award event, encoded as a list.

func (T) String

func (a T) String() string

String returns a log entry string for an award.T.

func (T) UnmarshalJSON

func (a T) UnmarshalJSON(b []byte) error

UnmarshalJSON decodes the JSON string b.

Jump to

Keyboard shortcuts

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