httputil

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

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decorate

func Decorate(handlers []HttpHandler) []gin.HandlerFunc

Decorate 装饰器

func SetMessager

func SetMessager(mg Messager)

Types

type BeforeCloseHandler

type BeforeCloseHandler func()

type GinServer

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

func NewServer

func NewServer() *GinServer

func NewWithEngine

func NewWithEngine(r *gin.Engine) *GinServer

func (*GinServer) AddBeforeServerCloseHandlers

func (s *GinServer) AddBeforeServerCloseHandlers(handlers ...BeforeCloseHandler)

func (*GinServer) Delete

func (s *GinServer) Delete(relativePath string, handlers ...HttpHandler)

func (*GinServer) Get

func (s *GinServer) Get(relativePath string, handlers ...HttpHandler)

func (*GinServer) Head

func (s *GinServer) Head(relativePath string, handlers ...HttpHandler)

func (*GinServer) HttpServer

func (s *GinServer) HttpServer() *http.Server

func (*GinServer) Post

func (s *GinServer) Post(relativePath string, handlers ...HttpHandler)

func (*GinServer) Put

func (s *GinServer) Put(relativePath string, handlers ...HttpHandler)

func (*GinServer) Run

func (s *GinServer) Run(addr string, logger logger.Logger) context.Context

func (*GinServer) Wait

func (s *GinServer) Wait()

type HttpHandler

type HttpHandler func(ctx *gin.Context) *Response

type Messager

type Messager interface {
	Message(code uint32) string
}

Messager is used to get message from code specified

type MessagerFunc

type MessagerFunc func(uint32) string

func (MessagerFunc) Message

func (m MessagerFunc) Message(code uint32) string

type Response

type Response struct {
	HttpStatus int
	R          resResult
}

func NewResponse

func NewResponse(status int, code uint32, data interface{}) *Response

func NewResponseOK

func NewResponseOK(code uint32, data interface{}) *Response

func NewResponseOKND

func NewResponseOKND(code uint32) *Response

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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