model

package
v0.0.0-...-3433f89 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2021 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	REJECTED              = "Rejected"
	PENDING               = "Pending"
	ACCEPTED              = "Accepted"
	WRONG_ANSWER          = "Wrong Answer"
	COMPILATION_ERROR     = "Compilation Error"
	TIME_LIMIT_EXCEEDED   = "Time Limit Exceeded"
	MEMORY_LIMIT_EXCEEDED = "Memory Limit Exceeded"
	RUNTIME_ERROR         = "Runtime Error"
)
View Source
const CONTAINER_TIMEOUT_MINUTES = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	gorm.Model
	ID          uint
	Title       string
	TimeLimit   float32
	MemoryLimit int
	Inputs      []InputFile  `gorm:"ForeignKey:ChallengeID"`
	Outputs     []OutputFile `gorm:"ForeignKey:ChallengeID"`
}

Challenge is a representation for the ORM of our challenges and their relevant information such as the challenge title, the memory and time constraints for the submissions and the set of input and outputs that represent the test cases.

type ExecutionResult

type ExecutionResult struct {
	TestName string `json:"testName"`
	Status   string `json:"status"`
	Message  string `json:"message"`
}

ExecutionResult represents the result of executing a given submission against one test case. TestName is the name of the test case, Status is the status of the test (i.e. "OK", "TLE" nad "RTE") and Message is used to store any relevant information, such as error messages.

type InputFile

type InputFile struct {
	TestFile
}

type InputsArray

type InputsArray []InputFile

func (InputsArray) TestFiles

func (files InputsArray) TestFiles() []TestFile

type OutputFile

type OutputFile struct {
	TestFile
}

type OutputsArray

type OutputsArray []OutputFile

func (OutputsArray) TestFiles

func (files OutputsArray) TestFiles() []TestFile

type Status

type Status struct {
	Verdict string
	Message string
}

type Submission

type Submission struct {
	gorm.Model
	ID          uint
	Language    string
	Source      []byte
	Status      Status `gorm:"embedded"`
	ChallengeID uint
}

type SubmissionForm

type SubmissionForm struct {
	Language    string                `form:"language"`
	Source      *multipart.FileHeader `form:"source"`
	ChallengeID uint                  `form:"challengeID"`
}

SubmissionForm is used to represent a submission. It contains the source code, a string identifiying the language of the source code and the ID of the challenge associated with this submission.

type TestFile

type TestFile struct {
	gorm.Model
	ID          uint
	Filename    string
	Content     []byte
	ChallengeID uint
}

TestFile represents the input of a single test case for a given challenge.

type TestFileArray

type TestFileArray []TestFile

func (TestFileArray) InputFiles

func (files TestFileArray) InputFiles() []InputFile

func (TestFileArray) OutputFiles

func (files TestFileArray) OutputFiles() []OutputFile

Jump to

Keyboard shortcuts

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