hint

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadHint

func LoadHint() gin.HandlerFunc

func RegisterRouter

func RegisterRouter(g *gin.RouterGroup)

Types

type Handler

type Handler struct {
}

func (*Handler) Create

func (*Handler) Create() gin.HandlerFunc

func (*Handler) List

func (*Handler) List() gin.HandlerFunc

func (*Handler) Modify

func (*Handler) Modify() gin.HandlerFunc

func (*Handler) Show

func (*Handler) Show() gin.HandlerFunc

func (*Handler) SingleDelete

func (*Handler) SingleDelete() gin.HandlerFunc

type RHint

type RHint struct {
	Cost       uint   `json:"cost"`
	Content    string `json:"content,omitempty"`
	IsUnlocked bool   `json:"is_unlocked"`
}

func BindHint

func BindHint(hint *cpt.Hint, isUnlocked bool) *RHint

func BindList

func BindList(db *gorm.DB, contest *cpt.Contest, problem *cpt.Problem, session *cpt.Session, hints []cpt.Hint) ([]*RHint, error)

type ReqCreate

type ReqCreate struct {
	Cost    uint   `json:"cost"`
	Content string `json:"content" validate:"required" binding:"required"`
}

type ReqModify

type ReqModify struct {
	Cost    *uint   `json:"cost"`
	Content *string `json:"content" validate:"omitempty,min=1" binding:"omitempty,min=1"`
}

func (*ReqModify) Bind

func (r *ReqModify) Bind(h *cpt.Hint)

type RespCreate

type RespCreate struct {
	Response
	HintOrder int `json:"hint_order,omitempty"`
}

type RespList

type RespList struct {
	Response
	Hints []*RHint `json:"hints"`
}

type RespShow

type RespShow struct {
	Response
	Hint *RHint `json:"hint"`
}

Jump to

Keyboard shortcuts

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