model

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

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

Go to latest
Published: Jan 30, 2017 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateChallenge

func CreateChallenge(c *Challenge) error

func CreateTest

func CreateTest(t *Test, input []byte) error

func CreateUser

func CreateUser(u *User) error

func Init

func Init(cfg *Configuration) error

func IsErrUserAlreadyExist

func IsErrUserAlreadyExist(err error) bool

Types

type Challenge

type Challenge struct {
	Id           int64  `xorm:"pk autoincr"`
	Name         string `xorm:"not null"`
	InternalName string `xorm:"unique not null"`
	Image        string `json:"-"` // Docker image name
	TargetPath   string `json:"-"` // Where file with been stored in container
	Cmd          string `json:"-"` // Command to check answer. Can be null
	Inject       string `json:"-"`
	Description  string `json:"-"`
	Points       int64
	Created      time.Time `xorm:"created"`
}

func Challenges

func Challenges(page, pageSize int, order string) ([]*Challenge, error)

func GetChallengeById

func GetChallengeById(id int64) (*Challenge, error)

func GetChallengeByInternalName

func GetChallengeByInternalName(name string) (*Challenge, error)

func (*Challenge) IsEqual

func (c *Challenge) IsEqual(o *Challenge) bool

func (*Challenge) Update

func (c *Challenge) Update() error

func (*Challenge) UpdateWithInfoFrom

func (c *Challenge) UpdateWithInfoFrom(o *Challenge) error

type Configuration

type Configuration struct {
	LocalTestFiles string
}

type ErrUserAlreadyExist

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

func (ErrUserAlreadyExist) Error

func (e ErrUserAlreadyExist) Error() string

type Test

type Test struct {
	Id          int64      `xorm:"pk autoincr"`
	ChallengeId int64      `xorm:"notnull"`
	UserId      int64      `xorm:"notnull"`
	IsSucess    bool       `xorm:"notnull"`
	Created     time.Time  `xorm:"notnull created"`
	Checked     *time.Time `xorm:"null"`
	Duration    time.Duration
}

func GetTestById

func GetTestById(id int64) (*Test, error)

func Tests

func Tests(page, pageSize int, onlyUntested bool, forUser int64) ([]*Test, error)

func (*Test) GetInputFileName

func (t *Test) GetInputFileName() string

func (*Test) GetOutputFileName

func (t *Test) GetOutputFileName() string

func (*Test) Update

func (t *Test) Update(output []byte) error

type User

type User struct {
	Id            int64     `xorm:"pk notnull autoincr"`
	Score         int64     `xorm:"notnull"`
	Created       time.Time `xorm:"notnull created"`
	Updated       time.Time `xorm:"notnull updated"`
	Email         string    `xorm:"notnull unique" json:"-"`
	EmailVerified bool      `json:"-"`
	Name          string    `xorm:"notnull"`
	Picture       string
}

func GetDebugUser

func GetDebugUser() *User

func GetUserByEmail

func GetUserByEmail(email string) (*User, error)

func GetUserById

func GetUserById(id int64) (*User, error)

func Users

func Users(page, pageSize int, order string) ([]*User, error)

func (*User) Update

func (u *User) Update() error

Jump to

Keyboard shortcuts

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