submissions

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

Documentation

Overview

submissions contains database storage actions for submissions and submission runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateGroupRun

func CreateGroupRun(ctx context.Context, run *models.TestGroupRun) error

func CreateRun

func CreateRun(ctx context.Context, run *models.SubmissionRun) error

CreateRun creates a new run for a submission.

func CreateRunTx

func CreateRunTx(ctx context.Context, run *models.SubmissionRun, tx *sqlx.Tx) error

CreateRun creates a new submission run in a transaction.

func CreateSubmission

func CreateSubmission(ctx context.Context, sub *models.Submission, problemVersion int32) error

CreateSubmission persists a new submission.

func CreateSubmissionTx

func CreateSubmissionTx(ctx context.Context, tx *sqlx.Tx, sub *models.Submission) error

CreateSubmissionTx persists a new submission within a transaction.

func ListRuns

func ListRuns(ctx context.Context, args RunListArgs, filterArgs RunListFilter) ([]*models.SubmissionRun, error)

ListRuns searches for a list of runs.

func UpdateRun

func UpdateRun(ctx context.Context, run *models.SubmissionRun, args UpdateRunArgs) error

UpdateRun updates the given submission run in the database.

Types

type ListArgs

type ListArgs struct {
	// Whether to include submission files in the query.
	WithFiles bool
	// Whether to include the current run in the query.
	WithRun       bool
	WithGroupRuns bool
	WithAccounts  bool
}

A ListArgs controls what data to include in submissions.

type ListFilter

type ListFilter struct {
	Submissions   *SubmissionFilter
	Users         *UserFilter
	Problems      *ProblemFilter
	OnlyAvailable bool
}

A ListFilter controls what submissions to search for.

type ProblemFilter

type ProblemFilter struct {
	ProblemIDs []int32
}

type RunField

type RunField string

A RunField represents a field in a run.

const (
	RunFieldVerdict      RunField = "verdict"
	RunFieldTimeUsageMs  RunField = "time_usage_ms"
	RunFieldScore        RunField = "score"
	RunFieldStatus       RunField = "status"
	RunFieldCompileError RunField = "compile_error"
)

type RunListArgs

type RunListArgs struct {
}

type RunListFilter

type RunListFilter struct {
	// Whether only unprocessed runs should be included.
	OnlyUnjudged bool
	RunID        []int32
}

A RunListFilter controls what runs to search for.

type SubmissionFilter

type SubmissionFilter struct {
	SubmissionIDs []int32
}

type SubmissionList

type SubmissionList []*models.Submission

A SubmissionList is a slice of Submissions.

func ListSubmissions

func ListSubmissions(ctx context.Context, args ListArgs, filterArgs ListFilter) (SubmissionList, error)

ListSubmissions searches for a list of submissions.

func (SubmissionList) ProblemIDs

func (lists SubmissionList) ProblemIDs() []int32

type UpdateRunArgs

type UpdateRunArgs struct {
	// The fields of a SubmissionRun to update.
	Fields []RunField
}

An UpdateRunArgs controls what to update in a run.

type UserFilter

type UserFilter struct {
	UserIDs []int32
}

Jump to

Keyboard shortcuts

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