ctl

package
v0.0.0-...-976ea1f Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Inject

func Inject(container *dig.Container) error

Inject 注入ctl 使用方式:

container := dig.New()
Inject(container)
container.Invoke(func(foo *ctl.Demo) {
})

Types

type Demo

type Demo struct {
	DemoBll bll.IDemo
}

Demo 示例程序

func NewDemo

func NewDemo(bDemo bll.IDemo) *Demo

NewDemo 创建demo控制器

func (*Demo) Create

func (a *Demo) Create(c *gin.Context)

Create 创建数据 @Tags Demo @Summary 创建数据 @Param Authorization header string false "Bearer 用户令牌" @Param body body schema.Demo true "创建数据" @Success 200 {object} schema.Demo @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos [post]

func (*Demo) Delete

func (a *Demo) Delete(c *gin.Context)

Delete 删除数据 @Tags Demo @Summary 删除数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id} [delete]

func (*Demo) Disable

func (a *Demo) Disable(c *gin.Context)

Disable 禁用数据 @Tags Demo @Summary 禁用数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id}/disable [patch]

func (*Demo) Enable

func (a *Demo) Enable(c *gin.Context)

Enable 启用数据 @Tags Demo @Summary 启用数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.HTTPStatus "{status:OK}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id}/enable [patch]

func (*Demo) Get

func (a *Demo) Get(c *gin.Context)

Get 查询指定数据 @Tags Demo @Summary 查询指定数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Success 200 {object} schema.Demo @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 404 {object} schema.HTTPError "{error:{code:0,message:资源不存在}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id} [get]

func (*Demo) Query

func (a *Demo) Query(c *gin.Context)

Query 查询数据 @Tags Demo @Summary 查询数据 @Param Authorization header string false "Bearer 用户令牌" @Param current query int true "分页索引" default(1) @Param pageSize query int true "分页大小" default(10) @Param code query string false "编号" @Param name query string false "名称" @Param status query int false "状态(1:启用 2:停用)" @Success 200 {array} schema.Demo "查询结果:{list:列表数据,pagination:{current:页索引,pageSize:页大小,total:总数量}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos [get]

func (*Demo) Update

func (a *Demo) Update(c *gin.Context)

Update 更新数据 @Tags Demo @Summary 更新数据 @Param Authorization header string false "Bearer 用户令牌" @Param id path string true "记录ID" @Param body body schema.Demo true "更新数据" @Success 200 {object} schema.Demo @Failure 400 {object} schema.HTTPError "{error:{code:0,message:无效的请求参数}}" @Failure 401 {object} schema.HTTPError "{error:{code:0,message:未授权}}" @Failure 500 {object} schema.HTTPError "{error:{code:0,message:服务器错误}}" @Router /api/v1/demos/{id} [put]

Jump to

Keyboard shortcuts

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