Help us shape the future of Go! Take the 2026 Go Developer Survey

server

package
v1.0.13 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UseCustomMidd added in v1.0.1

func UseCustomMidd(conf *config.Config, engin *gin.Engine)

Types

type CloseIRouter added in v1.0.4

type CloseIRouter interface {
	IRouter
	Close() error
}

type IRouter added in v1.0.1

type IRouter interface {
	Register(engine *gin.Engine)
}

IRouter 定义路由注册接口

type Server

type Server struct {
	Engine *gin.Engine

	Close func()
	// contains filtered or unexported fields
}

Server 是我们应用的核心结构体

func NewServer

func NewServer(conf *config.Config) *Server

NewServer 创建一个新的 Server 实例

func (*Server) RegisterRouters added in v1.0.1

func (s *Server) RegisterRouters(event event.IEvent, routers ...IRouter) []func() error

RegisterRouters 批量注册路由 参数是实现了 IRouter 接口的实例

func (*Server) Start added in v1.0.1

func (s *Server) Start()

Start 启动服务并实现优雅启停

Jump to

Keyboard shortcuts

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