model

package
v0.0.0-...-4bca548 Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ACProblems

func ACProblems(ctx context.Context, userID string) ([]string, error)

func CreateUser

func CreateUser(ctx context.Context, userID string, name string, comment string) error

func InitDB

func InitDB() (*sqlx.DB, error)

func StepExecute

func StepExecute(ctx context.Context, code string, state string, language string) (string, error)

func SubmitCode

func SubmitCode(ctx context.Context, userID string, problemID string, code string) (string, error)

func TryCreateProblem

func TryCreateProblem(ctx context.Context, creatorID string, score int, title string, text string, language string) (string, error)

func WAProblems

func WAProblems(ctx context.Context, userID string) ([]string, error)

Types

type Code

type Code struct {
	ID        string     `json:"id" db:"id"`
	UserID    string     `json:"userId" db:"user_id"`
	ProblemID string     `json:"problemId" db:"problem_id"`
	Code      string     `json:"code" db:"code"`
	Result    string     `json:"result" db:"result"`
	CreatedAt time.Time  `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time  `json:"updatedAt" db:"updated_at"`
	DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetCode

func GetCode(ctx context.Context, problemID string, codeID string) (Code, error)

func GetCodes

func GetCodes(ctx context.Context, userID string, problemID string) ([]Code, error)

type CodeAggregate

type CodeAggregate struct {
	ID          string     `json:"id" db:"id"`
	UserID      string     `json:"userId" db:"user_id"`
	UserName    string     `json:"userName" db:"user_name"`
	ProblemID   string     `json:"problemId" db:"problem_id"`
	ProblemName string     `json:"problemName" db:"problem_name"`
	Code        string     `json:"code" db:"code"`
	Result      string     `json:"result" db:"result"`
	CreatedAt   time.Time  `json:"createdAt" db:"created_at"`
	UpdatedAt   time.Time  `json:"updatedAt" db:"updated_at"`
	DeletedAt   *time.Time `json:"deletedAt" db:"deleted_at"`
}

type Problem

type Problem struct {
	ID        string     `json:"id" db:"id"`
	CreatorID string     `json:"creatorId" db:"creator_id"`
	Score     int        `json:"score" db:"score" form:"score"`
	Title     string     `json:"title" db:"title" form:"title"`
	Text      string     `json:"text" db:"text" form:"text"`
	Language  string     `json:"language" db:"language" form:"language"`
	CreatedAt time.Time  `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time  `json:"updatedAt" db:"updated_at"`
	DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"`
}

type ProblemAggregate

type ProblemAggregate struct {
	ID          string     `json:"id" db:"id"`
	CreatorID   string     `json:"creatorId" db:"creator_id"`
	CreatorName string     `json:"creatorName" db:"creator_name"`
	Result      string     `json:"result" db:"result"`
	Score       int        `json:"score" db:"score"`
	Title       string     `json:"title" db:"title"`
	Text        string     `json:"text" db:"text"`
	Language    string     `json:"language" db:"language"`
	CreatedAt   time.Time  `json:"createdAt" db:"created_at"`
	UpdatedAt   time.Time  `json:"updatedAt" db:"updated_at"`
	DeletedAt   *time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetProblem

func GetProblem(ctx context.Context, problemID string) (ProblemAggregate, error)

func GetProblemByUser

func GetProblemByUser(ctx context.Context, problemID string, userID string) (ProblemAggregate, error)

func GetProblems

func GetProblems(ctx context.Context) ([]ProblemAggregate, error)

func GetProblemsByUser

func GetProblemsByUser(ctx context.Context, userID string) ([]ProblemAggregate, error)

type Testcase

type Testcase struct {
	ID        string `json:"id" db:"id"`
	ProblemID string `json:"problemId" db:"problem_id"`
	Input     string `json:"input" db:"input"`
	Output    string `json:"output" db:"output"`
}

type User

type User struct {
	ID        string     `json:"id" db:"id" form:"id"`
	Name      string     `json:"name" db:"name" form:"name"`
	Comment   string     `json:"comment" db:"comment" form:"comment"`
	Score     int        `json:"score" db:"score"`
	CreatedAt time.Time  `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time  `json:"updatedAt" db:"updated_at"`
	DeletedAt *time.Time `json:"deletedAt" db:"deleted_at"`
}

func GetUser

func GetUser(ctx context.Context, userID string) (User, error)

func GetUsers

func GetUsers(ctx context.Context) ([]User, error)

Jump to

Keyboard shortcuts

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