server

package
v0.0.0-...-e964040 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2023 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Run

func Run(fn func(srv *Server))

Run .

Types

type Handler

type Handler func(ctx *hfwContext.Context) interface{}

Handler 业务处理。成功时返回 response, 失败时返回 webserver.WebError

type Router

type Router struct {
	*gin.RouterGroup
}

Router .

func (*Router) DELETE

func (r *Router) DELETE(uri string, h Handler)

DELETE .

func (*Router) GET

func (r *Router) GET(uri string, h Handler)

GET .

func (*Router) NewRouterGroup

func (r *Router) NewRouterGroup(p string) *Router

NewRouterGroup .

func (*Router) POST

func (r *Router) POST(uri string, h Handler)

POST .

func (*Router) PUT

func (r *Router) PUT(uri string, h Handler)

PUT .

type Server

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

Server .

func (*Server) Lifecycle

func (srv *Server) Lifecycle(hooks ...*lifecycle.Hook)

Lifecycle .

func (*Server) Publish

func (srv *Server) Publish(topic string, v interface{}, opts ...broker.PublishOption)

Publish 消息异步发布

func (*Server) RegisterRouter

func (srv *Server) RegisterRouter(fn func(r *Router))

RegisterRouter 注册路由

func (*Server) RegisterRouterGroup

func (srv *Server) RegisterRouterGroup(uri string, fn func(r *Router), handlers ...gin.HandlerFunc)

RegisterRouterGroup 注册路由组

func (*Server) Subscribe

func (srv *Server) Subscribe(topic string, handler broker.Handler, opts ...broker.SubscribeOption)

Subscribe 消息订阅

func (*Server) Unmarshal

func (srv *Server) Unmarshal(v interface{}) error

Unmarshal 序列化 configuration 中的自定义配置项

func (*Server) Use

func (srv *Server) Use(middleware ...gin.HandlerFunc)

Use .

Directories

Path Synopsis
jwt

Jump to

Keyboard shortcuts

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