contests

package
v0.0.0-...-1388524 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

contests contains database storage actions for contests.

Index

Constants

This section is empty.

Variables

View Source
var ErrAccountInTeam = errors.New("an account was already registered in the contest")
View Source
var ErrShortNameExists = errors.New("the shortname is in use")

ErrShortNameExists is returned when the given shortname already exists.

Functions

func CreateContest

func CreateContest(ctx context.Context, contest *models.Contest) error

CreateContest persists a contest in the database.

func CreateTeam

func CreateTeam(ctx context.Context, team *models.Team) error

CreateTeam persists a team with its members in the database.

func ListTeams

func ListTeams(ctx context.Context, filter TeamFilter) (models.TeamList, error)

ListTeams returns a list of teams.

func UpdateContest

func UpdateContest(ctx context.Context, contest *models.Contest) error

UpdateContest updates a contest within a transaction.

func UpdateTeam

func UpdateTeam(ctx context.Context, team *models.Team) error

Types

type ContestList

type ContestList []*models.Contest

An ContestList is a slice of contests.

func ListContests

func ListContests(ctx context.Context, args ListArgs, filter ListFilter) (ContestList, error)

ListContests returns a list of contests.

func (ContestList) Latest

func (lists ContestList) Latest() *models.Contest

type ListArgs

type ListArgs struct {
	WithProblems bool
}

type ListFilter

type ListFilter struct {
	// Filter by hostname.
	HostName string
}

A ContestFilter controls the filtering behaviour of ListContests.

type TeamFilter

type TeamFilter struct {
	ContestID int32
	AccountID int32
}

A TeamFilter controls the filtering behaviour of ListTeams.

Jump to

Keyboard shortcuts

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