lab

package
v0.0.0-...-e02a78a Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LabDir = "./labs"
)

Variables

This section is empty.

Functions

func Commit

func Commit(labId string) error

Types

type CheckPoint

type CheckPoint struct {
	Message      string         `yaml:"message" json:"message"`
	Weight       float32        `yaml:"weight" json:"weight"`
	Commands     Commands       `yaml:"commands" json:"commands,omitempty"`
	Dependencies map[string]int `yaml:"dependencies" json:"dependencies,omitempty"`
	Correct      bool           `yaml:"-" json:"correct"`
}

type CheckPoints

type CheckPoints map[string][]CheckPoint

func (CheckPoints) GormDBDataType

func (CheckPoints) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (CheckPoints) GormDataType

func (CheckPoints) GormDataType() string

func (CheckPoints) GormValue

func (js CheckPoints) GormValue(ctx context.Context, db *gorm.DB) (expr clause.Expr)

func (*CheckPoints) Scan

func (c *CheckPoints) Scan(value interface{}) (err error)

func (CheckPoints) Value

func (c CheckPoints) Value() (value driver.Value, err error)

type Command

type Command struct {
	Exec   []string `yaml:"exec" json:"exec"`
	Worker worker   `yaml:"worker" json:"worker"`
}

type Commands

type Commands []Command

func (Commands) GormDBDataType

func (Commands) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (Commands) GormDataType

func (Commands) GormDataType() string

func (Commands) GormValue

func (js Commands) GormValue(ctx context.Context, db *gorm.DB) (expr clause.Expr)

func (*Commands) Scan

func (c *Commands) Scan(value interface{}) (err error)

func (Commands) Value

func (c Commands) Value() (value driver.Value, err error)

type Content

type Content struct {
	Type contenttype.ContentType `yaml:"type" json:"type"`
	Name string                  `yaml:"name" json:"name"`
	Data string                  `yaml:"-" json:"data,omitempty"`
}

type Contents

type Contents []Content

func (Contents) GormDBDataType

func (Contents) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (Contents) GormDataType

func (Contents) GormDataType() string

func (Contents) GormValue

func (js Contents) GormValue(ctx context.Context, db *gorm.DB) (expr clause.Expr)

func (*Contents) Scan

func (c *Contents) Scan(value interface{}) (err error)

func (Contents) Value

func (c Contents) Value() (value driver.Value, err error)

type Deadline

type Deadline struct {
	Time  time.Time `yaml:"time" json:"time"`
	Score float32   `yaml:"score" json:"score"`
}

func (Deadline) MarshalYAML

func (c Deadline) MarshalYAML() (any, error)

func (*Deadline) UnmarshalYAML

func (c *Deadline) UnmarshalYAML(b *yaml.Node) error

type Deadlines

type Deadlines []Deadline

func (Deadlines) GormDBDataType

func (Deadlines) GormDBDataType(db *gorm.DB, field *schema.Field) string

func (Deadlines) GormDataType

func (Deadlines) GormDataType() string

func (Deadlines) GormValue

func (js Deadlines) GormValue(ctx context.Context, db *gorm.DB) (expr clause.Expr)

func (*Deadlines) Scan

func (c *Deadlines) Scan(value interface{}) (err error)

func (Deadlines) Value

func (c Deadlines) Value() (value driver.Value, err error)

type Lab

type Lab struct {
	ID          uint         `gorm:"primaryKey" yaml:"-" json:"-"`
	LabId       string       `gorm:"unique" yaml:"-" json:"labId"`
	Promissions []user.Group `gorm:"many2many:lab_promissions" yaml:"promissions" json:"promissions"`
	Deadlines   Deadlines    `yaml:"deadlines" json:"deadlines"`
	Timeout     duration     `yaml:"timeout" json:"timeout"`
	Network     ipv4net      `yaml:"network" json:"network"`
	Description string       `yaml:"description" json:"description"`
	Init        Commands     `yaml:"init" json:"init"`
	Clear       Commands     `yaml:"clear" json:"clear"`
	CheckPoints CheckPoints  `yaml:"checkpoints" json:"checkpoints"`
	Contents    Contents     `yaml:"contents" json:"contents"`
}

func GetLab

func GetLab(labId string) (lab Lab, err error)

func GetLabs

func GetLabs() (labs []Lab, err error)

func (Lab) ContainPromission

func (lab Lab) ContainPromission(group string) bool

Jump to

Keyboard shortcuts

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