Documentation ¶
Index ¶
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type ComplexityRoot
- type Config
- type Constraints
- type Description
- type DirectiveRoot
- type Evaluation
- type Example
- type ExecutionResult
- type Metadata
- type MutationResolver
- type ProgrammingLanguage
- type QueryResolver
- type Resolver
- type ResolverRoot
- type Submission
- type Task
- type Test
- type TestVerdictStatistic
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewExecutableSchema ¶
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
Types ¶
type ComplexityRoot ¶
type ComplexityRoot struct { Constraints struct { MemoryLimitKb func(childComplexity int) int TimeLimitMs func(childComplexity int) int } Description struct { Examples func(childComplexity int) int ID func(childComplexity int) int Input func(childComplexity int) int Notes func(childComplexity int) int Output func(childComplexity int) int Story func(childComplexity int) int } Evaluation struct { AvgMemoryKb func(childComplexity int) int AvgTimeMs func(childComplexity int) int ID func(childComplexity int) int MaxMemoryKb func(childComplexity int) int MaxTimeMs func(childComplexity int) int PossibleScore func(childComplexity int) int Status func(childComplexity int) int TestVerdictStatistics func(childComplexity int) int TotalScore func(childComplexity int) int } Example struct { Answer func(childComplexity int) int ID func(childComplexity int) int Input func(childComplexity int) int } ExecutionResult struct { Stderr func(childComplexity int) int Stdout func(childComplexity int) int } Metadata struct { Authors func(childComplexity int) int Origin func(childComplexity int) int } Mutation struct { CreateTask func(childComplexity int, name string, code string) int DeleteTask func(childComplexity int, id string) int EnqueueSubmissionForPublishedTaskVersion func(childComplexity int, taskID string, languageID string, submissionCode string) int ExecuteCode func(childComplexity int, code string, languageID string) int Login func(childComplexity int, username string, password string) int Logout func(childComplexity int) int PublishTask func(childComplexity int, id string) int Register func(childComplexity int, username string, password string, email string, firstName string, lastName string) int UpdateTaskConstraints func(childComplexity int, id string, timeLimitMs *int, memoryLimitKb *int) int UpdateTaskDescription func(childComplexity int, id string, code *string, name *string, story *string, input *string, output *string, notes *string) int UpdateTaskExamples func(childComplexity int, id string, inputs []string, outputs []string) int UpdateTaskMetadata func(childComplexity int, id string, authors []string, origin *string) int } ProgrammingLanguage struct { Enabled func(childComplexity int) int FullName func(childComplexity int) int ID func(childComplexity int) int MonacoID func(childComplexity int) int } Query struct { GetCurrentTaskVersionByID func(childComplexity int, id string) int GetPublishedTaskVersionByCode func(childComplexity int, code string) int ListEditableTasks func(childComplexity int) int ListLanguages func(childComplexity int, enabled *bool) int ListPublicSubmissions func(childComplexity int) int ListPublishedTasks func(childComplexity int) int Whoami func(childComplexity int) int } Submission struct { CreatedAt func(childComplexity int) int Evaluation func(childComplexity int) int ID func(childComplexity int) int Language func(childComplexity int) int Submission func(childComplexity int) int Task func(childComplexity int) int Username func(childComplexity int) int } Task struct { Code func(childComplexity int) int Constraints func(childComplexity int) int CreatedAt func(childComplexity int) int Description func(childComplexity int) int ID func(childComplexity int) int Metadata func(childComplexity int) int Name func(childComplexity int) int Tests func(childComplexity int) int UpdatedAt func(childComplexity int) int } Test struct { Answer func(childComplexity int) int ID func(childComplexity int) int Input func(childComplexity int) int Name func(childComplexity int) int } TestVerdictStatistic struct { Count func(childComplexity int) int Verdict func(childComplexity int) int } User struct { Email func(childComplexity int) int FirstName func(childComplexity int) int ID func(childComplexity int) int IsAdmin func(childComplexity int) int LastName func(childComplexity int) int Username func(childComplexity int) int } }
type Config ¶
type Config struct { Schema *ast.Schema Resolvers ResolverRoot Directives DirectiveRoot Complexity ComplexityRoot }
type Constraints ¶
type Description ¶
type DirectiveRoot ¶
type DirectiveRoot struct { }
type Evaluation ¶ added in v0.2.0
type Evaluation struct { ID string `json:"id"` Status string `json:"status"` TotalScore int `json:"totalScore"` PossibleScore *int `json:"possibleScore,omitempty"` AvgTimeMs *int `json:"avgTimeMs,omitempty"` MaxTimeMs *int `json:"maxTimeMs,omitempty"` AvgMemoryKb *int `json:"avgMemoryKb,omitempty"` MaxMemoryKb *int `json:"maxMemoryKb,omitempty"` TestVerdictStatistics []*TestVerdictStatistic `json:"testVerdictStatistics"` }
type ExecutionResult ¶
type MutationResolver ¶
type MutationResolver interface { Login(ctx context.Context, username string, password string) (*User, error) Register(ctx context.Context, username string, password string, email string, firstName string, lastName string) (*User, error) Logout(ctx context.Context) (bool, error) CreateTask(ctx context.Context, name string, code string) (*Task, error) UpdateTaskMetadata(ctx context.Context, id string, authors []string, origin *string) (*Task, error) UpdateTaskDescription(ctx context.Context, id string, code *string, name *string, story *string, input *string, output *string, notes *string) (*Task, error) UpdateTaskExamples(ctx context.Context, id string, inputs []string, outputs []string) (*Task, error) UpdateTaskConstraints(ctx context.Context, id string, timeLimitMs *int, memoryLimitKb *int) (*Task, error) PublishTask(ctx context.Context, id string) (*Task, error) DeleteTask(ctx context.Context, id string) (*Task, error) EnqueueSubmissionForPublishedTaskVersion(ctx context.Context, taskID string, languageID string, submissionCode string) (*Submission, error) ExecuteCode(ctx context.Context, code string, languageID string) (*ExecutionResult, error) }
type ProgrammingLanguage ¶ added in v0.2.0
type QueryResolver ¶
type QueryResolver interface { Whoami(ctx context.Context) (*User, error) ListPublishedTasks(ctx context.Context) ([]*Task, error) GetPublishedTaskVersionByCode(ctx context.Context, code string) (*Task, error) ListEditableTasks(ctx context.Context) ([]*Task, error) GetCurrentTaskVersionByID(ctx context.Context, id string) (*Task, error) ListLanguages(ctx context.Context, enabled *bool) ([]*ProgrammingLanguage, error) ListPublicSubmissions(ctx context.Context) ([]*Submission, error) }
type Resolver ¶
type Resolver struct { PostgresDB *sqlx.DB SessionManager *scs.SessionManager Logger *slog.Logger SubmissionRMQ *amqp.Connection }
func (*Resolver) GetUserFromContext ¶
func (*Resolver) Mutation ¶
func (r *Resolver) Mutation() MutationResolver
Mutation returns MutationResolver implementation.
func (*Resolver) Query ¶
func (r *Resolver) Query() QueryResolver
Query returns QueryResolver implementation.
type ResolverRoot ¶
type ResolverRoot interface { Mutation() MutationResolver Query() QueryResolver }
type Submission ¶
type Submission struct { ID string `json:"id"` Task *Task `json:"task"` Language *ProgrammingLanguage `json:"language"` Submission string `json:"submission"` Evaluation *Evaluation `json:"evaluation"` Username string `json:"username"` CreatedAt string `json:"createdAt"` }
type Task ¶
type Task struct { // The id of the task. Not the task version. ID string `json:"id"` Code string `json:"code"` Name string `json:"name"` Description *Description `json:"description"` Constraints *Constraints `json:"constraints"` Metadata *Metadata `json:"metadata"` Tests []*Test `json:"tests"` CreatedAt string `json:"createdAt"` UpdatedAt string `json:"updatedAt"` }
type TestVerdictStatistic ¶ added in v0.2.0
Click to show internal directories.
Click to hide internal directories.