server

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetDefaultServer

func SetDefaultServer(s *Server)

Types

type ApiRouter

type ApiRouter struct {
	RouterGroup
	// contains filtered or unexported fields
}

func NewApiRouter

func NewApiRouter() *ApiRouter

func (*ApiRouter) AddMiddleware

func (r *ApiRouter) AddMiddleware(m gin.HandlerFunc)

func (*ApiRouter) GetTasks

func (r *ApiRouter) GetTasks() []func(context.Context) func() error

GetTasks TODO 后续添加实现

func (*ApiRouter) RegisterHandler

func (r *ApiRouter) RegisterHandler(s *Server)

type Router

type Router interface {
	RegisterHandler(*Server)
	GetTasks() []func(context.Context) func() error
}

type RouterGroup

type RouterGroup struct {
	Handlers gin.HandlersChain
	// contains filtered or unexported fields
}

func (*RouterGroup) DELETE

func (group *RouterGroup) DELETE(relativePath string, handlerFunc ...gin.HandlerFunc)

func (*RouterGroup) GET

func (group *RouterGroup) GET(relativePath string, handlerFunc ...gin.HandlerFunc)

func (*RouterGroup) Group

func (group *RouterGroup) Group(relativePath string, middlewares ...gin.HandlerFunc) *RouterGroup

func (*RouterGroup) HEAD

func (group *RouterGroup) HEAD(relativePath string, handlerFunc ...gin.HandlerFunc)

func (*RouterGroup) OPTIONS

func (group *RouterGroup) OPTIONS(relativePath string, handlerFunc ...gin.HandlerFunc)

func (*RouterGroup) PATCH

func (group *RouterGroup) PATCH(relativePath string, handlerFunc ...gin.HandlerFunc)

func (*RouterGroup) POST

func (group *RouterGroup) POST(relativePath string, handlerFunc ...gin.HandlerFunc)

func (*RouterGroup) PUT

func (group *RouterGroup) PUT(relativePath string, handlerFunc ...gin.HandlerFunc)

type Server

type Server struct {
	Engine *gin.Engine
	// contains filtered or unexported fields
}
var (
	DefaultServer *Server
)

func NewServer

func NewServer(_ context.Context, appConfig *conf.AppConfig) *Server

func (*Server) AddMiddleware

func (s *Server) AddMiddleware(m gin.HandlerFunc)

func (*Server) AddRouter

func (s *Server) AddRouter(router Router)

func (*Server) AddTasks

func (s *Server) AddTasks(f ...func(context.Context) func() error)

func (*Server) AppName

func (s *Server) AppName() string

func (*Server) GetServerTasks

func (s *Server) GetServerTasks(ctx context.Context) []func() error

func (*Server) RunMode

func (s *Server) RunMode() string

Jump to

Keyboard shortcuts

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