controller

package
Version: v0.0.0-...-41229de Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

README

路由配置规则

直接通过 function 绑定 controller,function name 映射到 路由的地址

function named rule:

func(*Controller) GetLoginBy(id int64)
绑定的controller HTTP-method+routePath
map to - GET:/user/login/{param:long}

通过控制器方法的输入参数访问动态路径参数,不需要绑定。当您使用Iris的默认语法来解析来自控制器的处理程序时,您需要使用By字来为方法添加后缀,大写是一个新的子路径。例: 如这种形式 mvc.New(app.Party("/user")).Handle(new(user.Controller)) 则:

  • func(*Controller) Get() - GET:/user
  • func(*Controller) Post() - POST:/user
  • func(*Controller) GetLogin() - GET:/user/login
  • func(*Controller) PostLogin() - POST:/user/login
  • func(*Controller) GetProfileFollowers() - GET:/user/profile/followers
  • func(*Controller) PostProfileFollowers() - POST:/user/profile/followers
  • func(*Controller) GetBy(id int64) - GET:/user/{param:long}
  • func(*Controller) PostBy(id int64) - POST:/user/{param:long}

Go 编程规范不用下划线分割单词

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIJson

type APIJson struct {
	Code int         `json:"code"`
	Msg  interface{} `json:"msg"`
	Data interface{} `json:"data"`
}

func APIResult

func APIResult(code int, object interface{}, msg string) (apijson *APIJson)

APIResult 用户API 项目 忽略

type AdminController

type AdminController struct {
	Ctx iris.Context
}

AdminController admin

func (*AdminController) Get

func (c *AdminController) Get() mvc.Result

Get 根路径 uri: /admin

type IndexController

type IndexController struct {
	Ctx iris.Context
	Di  iris.Context
}

IndexController index controller

func (*IndexController) Get

func (c *IndexController) Get() mvc.Result

Get url: /

func (*IndexController) GetAdd

func (c *IndexController) GetAdd() mvc.Result

GetAdd 添加 job页面

func (*IndexController) GetDojob

func (c *IndexController) GetDojob()

GetDojob url: /dojob

func (*IndexController) GetGetlog

func (c *IndexController) GetGetlog() *APIJson

GetGetlog cron test job

func (*IndexController) GetInfo

func (c *IndexController) GetInfo() mvc.Result

GetInfo 详情

func (*IndexController) GetRPC

func (c *IndexController) GetRPC()

GetRPC 通过rpc执行 rpc 通过 http 调用启动,或通过tcp调用响应(暂时没有头绪)

func (*IndexController) GetRemovealljobs

func (c *IndexController) GetRemovealljobs()

GetRemovealljobs 移除所有任务

func (*IndexController) GetRemovejob

func (c *IndexController) GetRemovejob()

GetRemovejob 移除任务

func (*IndexController) GetStartjobs

func (c *IndexController) GetStartjobs()

GetStartjobs 开始任务

func (*IndexController) PostAdd

func (c *IndexController) PostAdd()

PostAdd 添加 job action

Jump to

Keyboard shortcuts

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