controller

package
v0.0.0-...-ff80121 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppHealth

func AppHealth(c *rux.Context)

@Tags InternalApi @Summary 检测API @Description get app health @Success 201 {string} json data @Failure 403 body is empty @Router /health [get]

func AppStatus

func AppStatus(c *rux.Context)

func Home

func Home(c *rux.Context)

func SwagDoc

func SwagDoc(c *rux.Context)

Types

type BaseApi

type BaseApi struct {
	// contains filtered or unexported fields
}

BaseApi controller

func (*BaseApi) DataRes

func (a *BaseApi) DataRes(c *rux.Context, data interface{}) *model.JsonData

DataRes response json data

func (*BaseApi) JSON

func (a *BaseApi) JSON(c *rux.Context, status int, data interface{})

func (*BaseApi) MakeRes

func (a *BaseApi) MakeRes(code int, err error, data interface{}) *model.JsonData

MakeRes code custom error code empty map:

c.DataRes(map[string]string{})

empty list:

c.DataRes([]int{})

err real error message, the message will not output, only write to log file.

type InternalApi

type InternalApi struct {
	BaseApi
}

InternalApi

func (*InternalApi) Config

func (a *InternalApi) Config(c *rux.Context)

@Tags InternalApi @Summary Get app config @Param key query string false "config key string" @Success 201 {string} json data @Failure 403 body is empty @router /config [get]

type UserApi

type UserApi struct {
	BaseApi
}

UserApi

func (*UserApi) AddRoutes

func (u *UserApi) AddRoutes(g *rux.Router)

AddRoutes for the API controller

func (*UserApi) GetOne

func (u *UserApi) GetOne(c *rux.Context)

@Tags UserApi @Summary Get one user detail by ID @Description get data by ID @Param id path int true "user ID" @Failure 200 {object} model.JsonMapData "We need ID!!" @Failure 404 {object} model.JsonMapData "Can not find ID" @Router /users/{id} [get]

func (*UserApi) Save

func (u *UserApi) Save(c *rux.Context)

@Tags UserApi @Summary create an new user @Description get data by ID @Param bodyData body form.CreateUserForm true "new user data" @Failure 200 {object} model.JsonMapData "We need ID!!" @Failure 404 {object} model.JsonMapData "Can not find ID" @Router /users [post]

Jump to

Keyboard shortcuts

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