imhttp

package
v0.0.0-...-bfc6946 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoginUID

func GetLoginUID(token string, tokenPrefix string, cache cache.Cache) string

GetLoginUID GetLoginUID

Types

type Context

type Context struct {
	*gin.Context
	// contains filtered or unexported fields
}

func (*Context) CheckLoginRole

func (c *Context) CheckLoginRole() error

func (*Context) GetAppID

func (c *Context) GetAppID() string

func (*Context) GetLoginName

func (c *Context) GetLoginName() string

func (*Context) GetLoginRole

func (c *Context) GetLoginRole() string

func (*Context) GetLoginUID

func (c *Context) GetLoginUID() string

func (*Context) GetPage

func (c *Context) GetPage() (pageIndex int64, pageSize int64)

func (*Context) ResponseError

func (c *Context) ResponseError(err error)

func (*Context) ResponseErrorWithStatus

func (c *Context) ResponseErrorWithStatus(err error, status int)

func (*Context) ResponseErrorf

func (c *Context) ResponseErrorf(msg string, err error)

func (*Context) ResponseOK

func (c *Context) ResponseOK()

func (*Context) ResponseWithStatus

func (c *Context) ResponseWithStatus(status int, data interface{})

type HandlerFunc

type HandlerFunc func(c *Context)

func CORSMiddleware

func CORSMiddleware() HandlerFunc

CORSMiddleware 跨域

type IMHttp

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

func New

func New() *IMHttp

func (*IMHttp) Any

func (imHttp *IMHttp) Any(relativePath string, handlers ...HandlerFunc)

func (*IMHttp) AuthMiddleware

func (imHttp *IMHttp) AuthMiddleware(cache cache.Cache, tokenPrefix string) HandlerFunc

AuthMiddleware 认证中间件

func (*IMHttp) GET

func (imHttp *IMHttp) GET(relativePath string, handlers ...HandlerFunc)

func (*IMHttp) Group

func (imHttp *IMHttp) Group(relativePath string, handlers ...HandlerFunc) *RouterGroup

Group Group

func (*IMHttp) HandleContext

func (imHttp *IMHttp) HandleContext(c *Context)

HandleContext HandleContext

func (*IMHttp) IMHttpHandler

func (imHttp *IMHttp) IMHttpHandler(handlerFunc HandlerFunc) gin.HandlerFunc

func (*IMHttp) LoadHTMLGlob

func (imHttp *IMHttp) LoadHTMLGlob(pattern string)

LoadHTMLGlob LoadHTMLGlob

func (*IMHttp) POST

func (imHttp *IMHttp) POST(relativePath string, handlers ...HandlerFunc)

func (*IMHttp) Run

func (imHttp *IMHttp) Run(addr ...string) error

func (*IMHttp) RunTLS

func (imHttp *IMHttp) RunTLS(addr, certFile, keyFile string) error

func (*IMHttp) ServeHTTP

func (imHttp *IMHttp) ServeHTTP(w http.ResponseWriter, req *http.Request)

ServeHTTP ServeHTTP

func (*IMHttp) Static

func (imHttp *IMHttp) Static(relativePath string, root string)

func (*IMHttp) Use

func (imHttp *IMHttp) Use(handlers ...HandlerFunc)

Use Use

func (*IMHttp) UseGin

func (imHttp *IMHttp) UseGin(handlers ...gin.HandlerFunc)

UseGin UseGin

type RouterGroup

type RouterGroup struct {
	*gin.RouterGroup
	L *IMHttp
}

RouterGroup RouterGroup

func (*RouterGroup) DELETE

func (r *RouterGroup) DELETE(relativePath string, handlers ...HandlerFunc)

DELETE DELETE

func (*RouterGroup) GET

func (r *RouterGroup) GET(relativePath string, handlers ...HandlerFunc)

GET GET

func (*RouterGroup) POST

func (r *RouterGroup) POST(relativePath string, handlers ...HandlerFunc)

POST POST

func (*RouterGroup) PUT

func (r *RouterGroup) PUT(relativePath string, handlers ...HandlerFunc)

PUT PUT

type UserRole

type UserRole string
const (
	Admin      UserRole = "admin"
	SuperAdmin UserRole = "superAdmin"
)

Jump to

Keyboard shortcuts

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