problems

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: 7 Imported by: 0

Documentation

Overview

problems contains database storage actions for problems and test data.

Index

Constants

View Source
const (
	TestsNone TestOpt = iota
	// Only load sample test groups.
	TestsSamples
	// Load only the test data structure.
	TestsGroups
	// Load only the sample test groups and the test data structure .
	TestsSamplesAndGroups
	// Load test data and validators.
	TestsAll

	StmtNone StmtOpt = iota
	// Include only titles.
	StmtTitles
	// Include titles and HTML statement.
	StmtAll
)

Variables

View Source
var ErrDuplicateProblemName = errors.New("duplicate problem name")

ErrDuplicateProblemName is returned when the inserted problem shortname already exists in the database.

Functions

func CreateProblem

func CreateProblem(ctx context.Context, p *models.Problem) error

CreateProblem persists a new problem into the database.

func GetStatementFile

func GetStatementFile(ctx context.Context, problemShort string, path string) (*models.ProblemStatementFile, error)

func List

func List(ctx context.Context, args ListArgs, filter ListFilter) (models.ProblemList, error)

func UpdateProblem

func UpdateProblem(ctx context.Context, problem *models.Problem) error

UpdateProblem updates a contest.

Types

type ListArgs

type ListArgs struct {
	WithStatements StmtOpt
	WithTests      TestOpt
}

type ListFilter

type ListFilter struct {
	ShortName string
	Problems  *ProblemFilter
	ContestID int32
}

A ListFilter filters the problems to search for. Only one filter may be set.

func Problems

func Problems(problemIDs ...int32) ListFilter

type ProblemFilter

type ProblemFilter struct {
	ProblemID []int32
}

type StmtOpt

type StmtOpt byte

type TestOpt

type TestOpt byte

Jump to

Keyboard shortcuts

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