Documentation ¶
Index ¶
- Variables
- func Init(sm *http.ServeMux, l *log.Logger, mongo *db.Mongo)
- type Controller
- type CreateSubmission
- type ExecutedTestCase
- type Handler
- func (h *Handler) Decide(w http.ResponseWriter, r *http.Request) utl.StatusCode
- func (h *Handler) GetHandler(w http.ResponseWriter, r *http.Request) (utl.StatusCode, *utl.ResponseBody)
- func (h *Handler) PostHandler(w http.ResponseWriter, r *http.Request) (utl.StatusCode, *utl.ResponseBody)
- func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)
- type M
- type Repository
- func (r *Repository) Find() ([]Submission, error)
- func (r *Repository) FindByID(id *primitive.ObjectID) (*Submission, error)
- func (r *Repository) FindBySubmissionNumber(submissionNumber int) (*Submission, error)
- func (r *Repository) Save(cs *CreateSubmission) (*primitive.ObjectID, error)
- func (r *Repository) Update(s *Submission) (*Submission, error)
- type Submission
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNoSubmission = errors.New("mongo: no submission in result")
Functions ¶
Types ¶
type Controller ¶
type Controller struct { Logger *log.Logger Repository *Repository // contains filtered or unexported fields }
func (*Controller) Create ¶
func (c *Controller) Create(cp *CreateSubmission) (utl.StatusCode, *utl.ResponseBody)
func (*Controller) Get ¶
func (h *Controller) Get(submissionNumber int) (utl.StatusCode, *utl.ResponseBody)
func (*Controller) Gets ¶
func (h *Controller) Gets() (utl.StatusCode, *utl.ResponseBody)
type CreateSubmission ¶
type CreateSubmission struct { ProblemNumber int `json:"problem_number"` Language string `json:"language"` Code string `json:"code"` }
func (*CreateSubmission) ToSubmission ¶
func (cs *CreateSubmission) ToSubmission() *Submission
type ExecutedTestCase ¶
type Handler ¶
type Handler struct { Logger *log.Logger Repository *Repository Controller *Controller }
func (*Handler) Decide ¶
func (h *Handler) Decide(w http.ResponseWriter, r *http.Request) utl.StatusCode
func (*Handler) GetHandler ¶
func (h *Handler) GetHandler(w http.ResponseWriter, r *http.Request) (utl.StatusCode, *utl.ResponseBody)
func (*Handler) PostHandler ¶
func (h *Handler) PostHandler(w http.ResponseWriter, r *http.Request) (utl.StatusCode, *utl.ResponseBody)
type Repository ¶
type Repository struct { Logger *log.Logger Collection *mongo.Collection }
func (*Repository) Find ¶
func (r *Repository) Find() ([]Submission, error)
func (*Repository) FindByID ¶
func (r *Repository) FindByID(id *primitive.ObjectID) (*Submission, error)
func (*Repository) FindBySubmissionNumber ¶
func (r *Repository) FindBySubmissionNumber(submissionNumber int) (*Submission, error)
func (*Repository) Save ¶
func (r *Repository) Save(cs *CreateSubmission) (*primitive.ObjectID, error)
func (*Repository) Update ¶
func (r *Repository) Update(s *Submission) (*Submission, error)
type Submission ¶
type Submission struct { ID primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"` SubmittedUsername string `bson:"submitted_username" json:"submitted_username"` ProblemNumber int `bson:"problem_number" json:"problem_number"` SubmissionNumber int `bson:"submission_number" json:"submission_number"` Status string `bson:"status" json:"status"` Language string `bson:"language" json:"language"` Code string `bson:"code" json:"code"` Runtime int `bson:"runtime" json:"runtime"` Memory int `bson:"memory" json:"memory"` ExecutedTestCases []ExecutedTestCase `bson:"executed_test_cases" json:"executed_test_cases"` CreatedAt time.Time `bson:"created_at" json:"created_at"` UpdatedAt time.Time `bson:"updated_at" json:"updated_at"` }
Click to show internal directories.
Click to hide internal directories.