gins

package
v0.0.0-...-849f898 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

DefaultMiddlewares ...

Functions

func RecoveryHandler

func RecoveryHandler(c *gin.Context)

RecoveryHandler recovery中间件的默认处理函数

func TranGinHandlerFunc2Interface

func TranGinHandlerFunc2Interface(datas []gin.HandlerFunc) []interface{}

TranGinHandlerFunc2Interface ...

Types

type GinBox

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

GinBox GinBox 对象

func DefaultBox

func DefaultBox() *GinBox

DefaultBox 默认的全局GinServerBox对象

func (*GinBox) HTTPRouter

func (g *GinBox) HTTPRouter(irouter IGinBoxRouter) error

HTTPRouter regist a http router

func (*GinBox) Handle

func (g *GinBox) Handle(name, method, relativePath string, handlers ...gin.HandlerFunc) error

Handle 根据参数处理server的route相关

func (*GinBox) Init

func (g *GinBox) Init(configs []*ServerConfig, middleware ...gin.HandlerFunc) error

Init 初始化默认的全局GinServerBox对象

func (*GinBox) Run

func (g *GinBox) Run() error

Run 启动并运行各个server 此函数会阻塞,直到各个server退出

func (*GinBox) Server

func (g *GinBox) Server(names ...string) *GinServer

Server 获取name指定的配置相关联的gin.Engine note: when len(names) == 0, return server named defaultServerName

func (*GinBox) Stop

func (g *GinBox) Stop() error

Stop 停止各个server 通常会等待各个server完全响应终止信号

type GinServer

type GinServer struct {
	ServerConfig
	// contains filtered or unexported fields
}

GinServer GinServer 对象

func NewGinServer

func NewGinServer(middleware ...gin.HandlerFunc) *GinServer

NewGinServer 快速的根据配置生成gin server 初始化时, 可以制定一些中间件作为 gin sever 的通用中间件 返回 GinServer 对象指针

func (*GinServer) Engine

func (g *GinServer) Engine() *gin.Engine

Engine 获取指定配置相关联的gin.Engine

func (*GinServer) Handle

func (g *GinServer) Handle(method, relativePath string, handlers ...gin.HandlerFunc) error

Handle 根据参数处理server的route相关

func (*GinServer) Init

func (g *GinServer) Init(conf *ServerConfig, middleware ...gin.HandlerFunc) error

Init 根据参数生成一个gin.Engine

func (*GinServer) Route

func (g *GinServer) Route(method, relativePath string, routes ...interface{}) error

Route 根据参数处理server的route相关

func (*GinServer) Run

func (g *GinServer) Run() error

Run 启动并运行server 此函数会阻塞,直到server退出

func (*GinServer) Stop

func (g *GinServer) Stop() error

Stop 停止server, 通常会等待server完全响应终止信号

type IGinBoxRouter

type IGinBoxRouter interface {
	HTTPRouter(ginbox *GinBox) error
}

IGinBoxRouter interface for gins's router

type ServerConfig

type ServerConfig = base.ServiceConfig

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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