jgin

package module
v0.0.0-...-c1222d2 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Recover

func Recover(c *gin.Context)

func ReturnDataMessage

func ReturnDataMessage(c *gin.Context, code int, msg string, data interface{})

func ReturnDataMessageU

func ReturnDataMessageU(c *gin.Context, code int, msg string, data interface{})

func ReturnError

func ReturnError(c *gin.Context, err error)

func ReturnErrorU

func ReturnErrorU(c *gin.Context, err error)

func ReturnListDataMessage

func ReturnListDataMessage(c *gin.Context, code int, msg string, data interface{})

func ReturnListDataMessageU

func ReturnListDataMessageU(c *gin.Context, code int, msg string, data interface{})

func ReturnMessage

func ReturnMessage(c *gin.Context, code int, msg string)

func ReturnMessageU

func ReturnMessageU(c *gin.Context, code int, msg string)

func TryGetQueryString

func TryGetQueryString(c *gin.Context, names ...string) string

获取请求参数

Types

type BaseController

type BaseController struct {
	IBaseController
	Name string `json:"name"`
}

type Controller

type Controller struct {
	Server *gin.Engine
	Group  *gin.RouterGroup
	// contains filtered or unexported fields
}

/defin controller

func (*Controller) AddHandle

func (c *Controller) AddHandle(m MethodType, p string, h gin.HandlerFunc)

func (*Controller) RegisterController

func (c *Controller) RegisterController()

type ControllerMethod

type ControllerMethod struct {
	Method MethodType
	Path   string
	Handle gin.HandlerFunc
}

/define api function

type DataController

type DataController struct {
	BaseController
}

func (*DataController) ReturnDataMessage

func (b *DataController) ReturnDataMessage(c *gin.Context, code int, message string, data interface{})

func (*DataController) ReturnError

func (b *DataController) ReturnError(c *gin.Context, code int, message error)

func (*DataController) ReturnMessage

func (b *DataController) ReturnMessage(c *gin.Context, code int, message string)

func (*DataController) ReturnPageMessage

func (b *DataController) ReturnPageMessage(c *gin.Context,
	code int, message string,
	pageSize int, pageNo int,
	totalCount int, totalPage int,
	data interface{})

func (*DataController) Upload

func (b *DataController) Upload(c *gin.Context, filed string, path string, name string) (string, error)

func (*DataController) Uploads

func (b *DataController) Uploads(c *gin.Context, filed string, path string) (map[string]string, error)

type GinServer

type GinServer struct {
	Server *gin.Engine
	// contains filtered or unexported fields
}

/define server

func New

func New() *GinServer

/build server

func (*GinServer) NewController

func (c *GinServer) NewController(path string) *Controller

new controller

func (*GinServer) RegisterController

func (c *GinServer) RegisterController()

func (*GinServer) Start

func (c *GinServer) Start(host string, port string)

start server with ip and port

func (*GinServer) StartUrl

func (c *GinServer) StartUrl(url string)

func (*GinServer) WithRelease

func (c *GinServer) WithRelease() *GinServer

release mode

type HTTPDataResponse

type HTTPDataResponse struct {
	HTTPResponse
	Data interface{} `json:"Data"`
}

type HTTPListResponse

type HTTPListResponse struct {
	HTTPResponse
	Count int         `json:"Count"`
	Data  interface{} `json:"Data"`
}

type HTTPPageResponse

type HTTPPageResponse struct {
	HTTPResponse
	PageSize   int         `json:"PageSize"`
	PageNo     int         `json:"PageNo"`
	TotalCount int         `json:"TotalCount"`
	TotalPage  int         `json:"TotalPage"`
	Data       interface{} `json:"Data"`
}

type HTTPResponse

type HTTPResponse struct {
	Code    int    `json:"Code"`
	Message string `json:"Message"`
}

type HttpDataResponse

type HttpDataResponse struct {
	HttpResponse
	Data interface{} `json:"data"`
}

type HttpListResponse

type HttpListResponse struct {
	HttpResponse
	Data interface{} `json:"data"`
}

type HttpPageResponse

type HttpPageResponse struct {
	HttpResponse
	PageSize   int         `json:"pageSize"`
	PageNo     int         `json:"pageNo"`
	TotalCount int         `json:"totalCount"`
	TotalPage  int         `json:"totalPage"`
	Data       interface{} `json:"data"`
}

type HttpResponse

type HttpResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

type IBaseController

type IBaseController interface {
	Register(server *GinServer)
}

type MethodType

type MethodType uint32

/define http method

const (
	GET MethodType = 1 + iota
	POST
	PUT
	DELETE
)

Jump to

Keyboard shortcuts

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