server

package
v0.0.0-...-8de752a Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(authToken string) func(c *fiber.Ctx) error

func ErrorMiddleware

func ErrorMiddleware(c *fiber.Ctx, err error) error

func ProvideServer

func ProvideServer(cfg *infra.Config, logger *logrus.Logger, controller *Controller) *fiber.App

func RegisterRoutes

func RegisterRoutes(server *fiber.App, controller *Controller)

Types

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(getRuntimes *usecase.GetRuntimes, runCode *usecase.RunCode, judgeCode *usecase.JudgeCode) *Controller

func (*Controller) GetRuntimes

func (c *Controller) GetRuntimes(ctx *fiber.Ctx) error

func (*Controller) Judge

func (c *Controller) Judge(ctx *fiber.Ctx) error

func (*Controller) Run

func (c *Controller) Run(ctx *fiber.Ctx) error

type JudgeRequestSchema

type JudgeRequestSchema struct {
	Language  string `validate:"required" json:"language"`
	Code      string `validate:"required" json:"code"`
	TestCases []struct {
		Input          string `validate:"required" json:"input"`
		ExpectedOutput string `validate:"required" json:"expectedOutput"`
	} `validate:"required" json:"testCases"`
	Options *usecase.JudgeCodeOptions `json:"options,omitempty"`
}

type RunOptionsSchema

type RunOptionsSchema struct {
	TimeLimit   *float64 `json:"timeLimit,omitempty"`
	MemoryLimit *int     `json:"memoryLimit,omitempty"`
}

type RunRequestSchema

type RunRequestSchema struct {
	Language string                  `validate:"required" json:"language"`
	Code     string                  `validate:"required" json:"code"`
	Stdin    string                  `json:"stdin"`
	Options  *usecase.RunCodeOptions `json:"options,omitempty"`
}

type SchemaValidator

type SchemaValidator struct {
	// contains filtered or unexported fields
}

func NewSchemaValidator

func NewSchemaValidator() SchemaValidator

func (*SchemaValidator) Validate

func (schemaValidator *SchemaValidator) Validate(dto interface{}) (string, bool)

func (*SchemaValidator) ValidateStrict

func (schemaValidator *SchemaValidator) ValidateStrict(data []byte, dto interface{}) (string, bool)

Jump to

Keyboard shortcuts

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