httpwrap

package
v0.0.0-...-16501d2 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GET

func GET(router Router, relativePath string, messageType IMessage)

func Gin

func Gin() *gin.Engine

func Group

func Group(relativePath string) *gin.RouterGroup

func HandleMessage

func HandleMessage(messageType IMessage) gin.HandlerFunc

HandleMessage 绑定消息工厂

func InitHTTP

func InitHTTP(useGZip bool) (err error)

func POST

func POST(router Router, relativePath string, messageType IMessage)

func Run

func Run(addr string) (err error)

Types

type BaseMessage

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

func (*BaseMessage) JSON

func (m *BaseMessage) JSON(code int, data interface{})

func (*BaseMessage) SetContext

func (m *BaseMessage) SetContext(ctx *gin.Context)

type BaseReply

type BaseReply struct {
	Code    int
	Data    interface{}
	Command interface{}
}

type IMessage

type IMessage interface {
	Do()
	SetContext(ctx *gin.Context)
}

type MessageProcess

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

MessageProcess 消息工厂

type Router

type Router interface {
	POST(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
	GET(relativePath string, handlers ...gin.HandlerFunc) gin.IRoutes
}

Jump to

Keyboard shortcuts

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