database

package
v0.2.9 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateSubmissionEvaluation

func CreateSubmissionEvaluation(db sqlx.Queryer,
	taskSubmissionId int64, evalTaskVersionId int64,
	testMaximumTimeMs *int64, testMaximumMemoryKb *int64,
	testTotalTimeMs int64, testTotalMemoryKb int64,
	evalStatusId string, evalTotalScore int64, evalPossibleScore int64,
	compilationStdout *string, compilationStderr *string,
	compilationTimeMs *int64, compilationMemoryKb *int64) (int64, error)

creates a submission evaluation and returns its id

func CreateTaskSubmission

func CreateTaskSubmission(db sqlx.Queryer,
	userId int64, taskId int64, programmingLangId string,
	submission string) (int64, error)

creates a task submission and returns its id

func CreateUser

func CreateUser(db *sqlx.DB, username string, hashed_password string, email string,
	firstName string, lastName string) error

func DeleteUserById

func DeleteUserById(db *sqlx.DB, id int64) error

func DoesUserExistByEmail

func DoesUserExistByEmail(db *sqlx.DB, email string) (bool, error)

func DoesUserExistByUsername

func DoesUserExistByUsername(db *sqlx.DB, username string) (bool, error)

Types

type EvalType

type EvalType struct {
	ID            string `db:"id"`
	DescriptionEn string `db:"description_en"`
}

type MarkdownStatement

type MarkdownStatement struct {
	ID            int64   `db:"id"`
	Story         string  `db:"story"`
	Input         string  `db:"input"`
	Output        string  `db:"output"`
	Notes         *string `db:"notes"`
	Scoring       *string `db:"scoring"`
	TaskVersionID int64   `db:"task_version_id"`
}

type ProgrammingLanguage

type ProgrammingLanguage struct {
	ID             string  `db:"id"`
	FullName       string  `db:"full_name"`
	CodeFilename   string  `db:"code_filename"`
	CompileCmd     *string `db:"compile_cmd"`
	ExecuteCmd     string  `db:"execute_cmd"`
	EnvVersionCmd  string  `db:"env_version_cmd"`
	HelloWorldCode string  `db:"hello_world_code"`
	MonacoId       string  `db:"monaco_id"`
}

type SubmissionEvaluation

type SubmissionEvaluation struct {
	ID                  int64     `db:"id"`
	TaskSubmissionID    int64     `db:"task_submission_id"`
	EvalTaskVersionID   int64     `db:"eval_task_version_id"`
	TestMaximumTimeMs   *int64    `db:"test_maximum_time_ms"`
	TestMaximumMemoryKb *int64    `db:"test_maximum_memory_kb"`
	TestTotalTimeMs     int64     `db:"test_total_time_ms"`
	TestTotalMemoryKb   int64     `db:"test_total_memory_kb"`
	EvalStatusId        string    `db:"eval_status_id"`
	EvalTotalScore      int64     `db:"eval_total_score"`
	EvalPossibleScore   *int64    `db:"eval_possible_score"`
	CompilationStdout   *string   `db:"compilation_stdout"`
	CompilationStderr   *string   `db:"compilation_stderr"`
	CompilationTimeMs   *int64    `db:"compilation_time_ms"`
	CompilationMemoryKb *int64    `db:"compilation_memory_kb"`
	CreatedAt           time.Time `db:"created_at"`
	UpdateAt            time.Time `db:"updated_at"`
}

type Task

type Task struct {
	ID          int64     `db:"id"`
	CreatedAt   time.Time `db:"created_at"`
	CreatedByID int64     `db:"created_by_id"`

	RelevantVersionID  *int64 `db:"relevant_version_id"`
	PublishedVersionID *int64 `db:"published_version_id"`
}

func SelectTaskById

func SelectTaskById(db *sqlx.DB, id int64) (*Task, error)

type TaskAuthor

type TaskAuthor struct {
	TaskID string `db:"task_id"`
	Author string `db:"author"`
}

type TaskSource

type TaskSource struct {
	Abbreviation string `db:"abbreviation"`
	FullName     string `db:"full_name"`
}

type TaskVersion

type TaskVersion struct {
	ID            int64      `db:"id"`
	TaskID        int64      `db:"task_id"`
	ShortCode     string     `db:"short_code"`
	FullName      string     `db:"full_name"`
	TimeLimMs     int        `db:"time_lim_ms"`
	MemLimKb      int        `db:"mem_lim_kb"`
	TestingTypeID string     `db:"testing_type_id"`
	Origin        *string    `db:"origin"`
	CreatedAt     time.Time  `db:"created_at"`
	UpdatedAt     *time.Time `db:"updated_at"`
	CheckerID     *int64     `db:"checker_id"`
	InteractorID  *int64     `db:"interactor_id"`
}

func SelectTaskVersionById

func SelectTaskVersionById(db *sqlx.DB, id int64) (*TaskVersion, error)

type User

type User struct {
	ID             int64      `db:"id"`
	Username       string     `db:"username"`
	HashedPassword string     `db:"hashed_password"`
	Email          string     `db:"email"`
	FirstName      string     `db:"first_name"`
	LastName       string     `db:"last_name"`
	CreatedAt      time.Time  `db:"created_at"`
	UpdatedAt      *time.Time `db:"updated_at"`
	IsAdmin        bool       `db:"is_admin"`
}

func SelectUserByUsername

func SelectUserByUsername(db *sqlx.DB, username string) (*User, error)

Directories

Path Synopsis
proglv

Jump to

Keyboard shortcuts

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