model

package
v0.0.0-...-a35a875 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2023 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MetaFieldsSelection = []string{"create_at", "update_at", "deleted_at"}
View Source
var ProblemInfoSelection = append([]string{"slug", "title"}, MetaFieldsSelection...)
View Source
var PublicUserSelection = append([]string{"account", "name"}, MetaFieldsSelection...)

Functions

This section is empty.

Types

type AlgorithmTag

type AlgorithmTag struct {
	MetaFields
	Slug     string     `gorm:"primaryKey" json:"slug"`
	Name     string     `gorm:"not null" json:"name"`
	Problems []*Problem `gorm:"many2many:problem_algorithm_tags;" json:"problems,omitempty"`
}

type CheckPoint

type CheckPoint struct {
	ID           string `gorm:"primaryKey"`
	SubmissionID string `gorm:"not null"`
	TestCaseID   string `gorm:"not null"`
	Result       string `gorm:"not null"`
}

type JudgeTask

type JudgeTask struct {
	UID         string `json:"uid"`
	ProblemSlug string `json:"problemSlug"`
	Src         string `json:"src"`
	SrcLanguage string `json:"srcLanguage"`
}

func NewJudgeTask

func NewJudgeTask(problemSlug, src, srcLanguage string) *JudgeTask

type MetaFields

type MetaFields struct {
	CreateAt  *time.Time `gorm:"autoCreateTime" json:"createAt,omitempty"`
	UpdateAt  *time.Time `gorm:"autoUpdateTime" json:"updateAt,omitempty"`
	DeletedAt *time.Time `gorm:"index" json:"deletedAt,omitempty"`
}

type Problem

type Problem struct {
	MetaFields
	Slug        string          `gorm:"primaryKey" json:"slug"`
	Title       string          `gorm:"not null" json:"title"`
	Description *string         `gorm:"not null" json:"description,omitempty"`
	Tags        []*AlgorithmTag `gorm:"many2many:problem_algorithm_tags;" json:"tags"`
}

func (Problem) ToProblemInfo

func (p Problem) ToProblemInfo() ProblemInfo

type ProblemInfo

type ProblemInfo struct {
	MetaFields
	Slug  string          `json:"slug"`
	Title string          `json:"title"`
	Tags  []*AlgorithmTag `json:"tags"`
}

type Role

type Role struct {
	MetaFields
	Name  string  `gorm:"primaryKey" json:"name"`
	Users []*User `gorm:"many2many:user_roles" json:"users,omitempty"`
}

type Submission

type Submission struct {
	ID         string    `gorm:"primaryKey"`
	ProblemID  string    `gorm:"not null"`
	UserID     string    `gorm:"not null"`
	Language   string    `gorm:"not null"`
	Code       string    `gorm:"not null"`
	Status     string    `gorm:"not null"`
	Visibility bool      `gorm:"not null"`
	CreateAt   time.Time `gorm:"autoCreateTime"`
	UpdateAt   time.Time `gorm:"autoUpdateTime"`
}

type User

type User struct {
	MetaFields
	Account        string  `gorm:"primaryKey" json:"account"`
	Name           string  `json:"name"`
	Password       *string `gorm:"-:all" json:"password,omitempty"`
	HashedPassword string  `gorm:"not null" json:"-"`
	Roles          []*Role `gorm:"many2many:user_roles;" json:"roles,omitempty"`
	Email          *string `gorm:"unique" json:"email,omitempty"`
	Mobile         *string `gorm:"unique" json:"mobile,omitempty"`
}

Jump to

Keyboard shortcuts

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