api

package
v0.0.0-...-49281bb Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2021 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BatchSave

func BatchSave(db *gorm.DB, perms []sys.Api) error

BatchSave 批量插入数据

func CheckExist

func CheckExist(str string, existList []string) bool

Types

type Api

type Api struct {
	DB *gorm.DB
}

func (Api) Create

func (r Api) Create(c *gin.Context)

Create @Tags Api接口管理 @Summary 创建Api接口 @Description Api @Produce json @Security ApiKeyAuth @Param payload body PostSchema true "参数信息" @Success 200 object response.Data {"code": 2000, "status": "ok", "message": "success", "data": ""} @Failure 400 object response.Data {"code": 4001, "status": "error", "message": "error", "data": ""} @Router /api/v1/sys/api [post]

func (Api) Delete

func (r Api) Delete(c *gin.Context)

Delete @Tags Api接口管理 @Summary 删除Api接口 @Description Api @Produce json @Security ApiKeyAuth //@Param id path int true "ID" @Param payload body DeleteSchema true "参数信息: {rows:[1,2]}" @Success 200 object response.Data {"code": 2000, "status": "ok", "message": "success", "data": ""} @Failure 400 object response.Data {"code": 4001, "status": "error", "message": "error", "data": ""} @Router /api/v1/sys/api [delete]

func (Api) Get

func (r Api) Get(c *gin.Context)

Get @Tags Api接口管理 @Summary Api接口详细 @Description Api @Produce json @Security ApiKeyAuth @Param id path int true "ID" @Success 200 object response.Data {"code": 2000, "status": "ok", "message": "success", "data": ""} @Failure 400 object response.Data {"code": 4001, "status": "error", "message": "error", "data": ""} @Router /api/v1/sys/api/{id} [get]

func (Api) GetAllGroup

func (r Api) GetAllGroup(c *gin.Context)

GetAllGroup @Tags Api接口管理 @Summary Api接口Group @Description Api @Produce json @Security ApiKeyAuth @Success 200 object response.Data {"code": 2000, "status": "ok", "message": "success", "data": ""} @Failure 400 object response.Data {"code": 4001, "status": "error", "message": "error", "data": ""} @Router /api/v1/sys/api-group [get]

func (Api) GetAllPerm

func (r Api) GetAllPerm(c *gin.Context)

GetAllPerm @Tags Api接口管理 @Summary Api接口详细 @Description Api @Produce json @Security ApiKeyAuth @Param id path int true "ID" @Success 200 object response.Data {"code": 2000, "status": "ok", "message": "success", "data": ""} @Failure 400 object response.Data {"code": 4001, "status": "error", "message": "error", "data": ""} @Router /api/v1/sys/apis [get]

func (Api) Option

func (r Api) Option() db.Option

func (Api) Query

func (r Api) Query(c *gin.Context)

Query @Tags Api接口管理 @Summary Api接口列表 @Description Api @Produce json @Security ApiKeyAuth @Param name query string false "Api接口名" @Success 200 object response.Data {"code": 2000, "status": "ok", "message": "success", "data": ""} @Failure 400 object response.Data {"code": 4001, "status": "error", "message": "error", "data": ""} @Router /api/v1/sys/api [get]

func (Api) Update

func (r Api) Update(c *gin.Context)

Update @Tags Api接口管理 @Summary 更新Api接口 @Description Api @Produce json @Security ApiKeyAuth @Param id path int true "ID" @Param payload body PutSchema true "参数信息" @Success 200 object response.Data {"code": 2000, "status": "ok", "message": "success", "data": ""} @Failure 400 object response.Data {"code": 4001, "status": "error", "message": "error", "data": ""} @Router /api/v1/sys/api/{id} [put]

func (Api) UpdateApi

func (r Api) UpdateApi(conditions []sys.Api) error

type DeleteSchema

type DeleteSchema struct {
	Rows []uint `json:"rows"`
}

type IApi

type IApi interface {
	app.CommonInterfaces
	GetAllPerm(c *gin.Context)
	GetAllGroup(c *gin.Context)
	UpdateApi(conditions []sys.Api) error
}

func NewService

func NewService(DB *gorm.DB) IApi

type PostSchema

type PostSchema struct {
	Name     string `json:"name" binding:"required"`
	Title    string `json:"title" binding:"required"`
	Group    string `json:"group"`
	Disabled bool   `json:"disabled"`
	Path     string `json:"path"`
	Method   string `json:"Method"`
}

func (PostSchema) TableName

func (PostSchema) TableName() string

type PutSchema

type PutSchema struct {
	Name     *string `json:"name"`
	Title    *string `json:"title"`
	Group    *string `json:"group"`
	Disabled *bool   `json:"disabled"`
	Path     *string `json:"path"`
	Method   *string `json:"Method"`
}

func (PutSchema) TableName

func (PutSchema) TableName() string

type ShowData

type ShowData struct {
	ID     uint   `json:"id"`
	Name   string `json:"name" form:"name"`
	Url    string `json:"url"`
	Method string `json:"Method"`
}

func (ShowData) TableName

func (ShowData) TableName() string

type ShowGroupData

type ShowGroupData struct {
	Group string `json:"group" form:"group"`
}

func (ShowGroupData) TableName

func (ShowGroupData) TableName() string

Jump to

Keyboard shortcuts

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