controller

package
v0.0.0-...-9776187 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseController

type BaseController struct{}

func (*BaseController) GetInt

func (b *BaseController) GetInt(s string) int

GetInt get int.

type HomeController

type HomeController struct {
	BaseController
}

HomeController home ctrl.

func (*HomeController) Hello

func (h *HomeController) Hello(w http.ResponseWriter, r *http.Request)

Hello hello func.

func (*HomeController) Info

Info 测试参数校验 http://localhost:1338/get-info?limit=12&uid=1&name=abcdeabcde

func (*HomeController) Post

Post post.

func (*HomeController) Test

Test test.

type IndexController

type IndexController struct{}

IndexController index ctrl.

func (*IndexController) ArticleIdCtx

func (ctrl *IndexController) ArticleIdCtx(next http.Handler) http.Handler

ArticleIdCtx 设置http context value 中间件

func (*IndexController) Category

func (ctrl *IndexController) Category(w http.ResponseWriter, r *http.Request)

Category category

func (*IndexController) DeleteArticleId

func (ctrl *IndexController) DeleteArticleId(w http.ResponseWriter, r *http.Request)

DeleteArticleId delete.

func (*IndexController) GetArticleId

func (ctrl *IndexController) GetArticleId(w http.ResponseWriter, r *http.Request)

GetArticleId get art id.

func (*IndexController) Home

func (ctrl *IndexController) Home(w http.ResponseWriter, r *http.Request)

Home home.

func (*IndexController) Info

func (ctrl *IndexController) Info(w http.ResponseWriter, r *http.Request)

Info from a route like /info/{userID}

func (*IndexController) MockPanic

func (ctrl *IndexController) MockPanic(w http.ResponseWriter, r *http.Request)

MockPanic 模拟发生panic操作

func (*IndexController) Test

func (ctrl *IndexController) Test(w http.ResponseWriter, r *http.Request)

Test test.

func (*IndexController) UpdateArticleId

func (ctrl *IndexController) UpdateArticleId(w http.ResponseWriter, r *http.Request)

UpdateArticleId update art id.

type InfoReq

type InfoReq struct {
	Uid   int    `json:"uid" validate:"required,min=1"`
	Limit int    `json:"limit" validate:"required,min=1,max=20"`
	Name  string `json:"name" validate:"omitempty,max=10"`
}

InfoReq info req.

Jump to

Keyboard shortcuts

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