db

package
v0.0.0-...-601d811 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Contest

type Contest struct {
	ID              int    `json:"id"`
	ContestID       int64  `json:"contest_id"`
	Name            string `json:"name"`
	Type            string `json:"type"`
	Phase           string `json:"phase"`
	Frozen          bool   `json:"frozen"`
	DurationSeconds int64  `json:"duration_seconds"`
	StartUnixTime   int64  `json:"start_unix_time"`
}

type DB

type DB struct {
	Db      *pg.DB
	BaseURL string
	Port    string
}

DB represents a struct for

func NewDB

func NewDB(username, password, dbName, baseURL, port string) *DB

NewDB returns an DB pointer to communicate with the database

func (*DB) Contests

func (d *DB) Contests(c echo.Context) (err error)

func (*DB) Problems

func (d *DB) Problems(c echo.Context) (err error)

Problems returns json data for all problems from db

func (*DB) Submissions

func (d *DB) Submissions(c echo.Context) (err error)

Submissions returns json data for user submissions from db

func (*DB) UpdateContests

func (d *DB) UpdateContests(c echo.Context) (err error)

func (*DB) UpdateProblems

func (d *DB) UpdateProblems(c echo.Context) (err error)

func (*DB) UpdateSubmissions

func (d *DB) UpdateSubmissions(c echo.Context) (err error)

type Problem

type Problem struct {
	ID          int      `json:"id"`
	ContestID   int      `json:"contest_id"`
	Name        string   `json:"name"`
	Index       string   `json:"index"`
	Points      float32  `json:"points"`
	Tags        []string `json:"tags" sql:",array"`
	SolvedCount int      `json:"solved_count"`
	ProblemKey  string   `json:"problem_key"`
}

Problem represents a Codefoces problem

type Submission

type Submission struct {
	ID                  int    `json:"id"`
	SubmissionID        int    `json:"submission_id"`
	Handle              string `json:"handle"`
	ContestID           int    `json:"contest_id"`
	Index               string `json:"index"`
	CreateUnixTime      int64  `json:"create_unix_time"`
	ProgrammingLanguage string `json:"programming_language"`
	Verdict             string `json:"verdict"`
	ProblemKey          string `json:"problem_key"`
}

Jump to

Keyboard shortcuts

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