server

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllocsHandler

func AllocsHandler() gin.HandlerFunc

AllocsHandler will pass the call from /debug/pprof/allocs to pprof

func BlockHandler

func BlockHandler() gin.HandlerFunc

BlockHandler will pass the call from /debug/pprof/block to pprof

func CmdlineHandler

func CmdlineHandler() gin.HandlerFunc

CmdlineHandler will pass the call from /debug/pprof/cmdline to pprof

func GoroutineHandler

func GoroutineHandler() gin.HandlerFunc

GoroutineHandler will pass the call from /debug/pprof/goroutine to pprof

func HeapHandler

func HeapHandler() gin.HandlerFunc

HeapHandler will pass the call from /debug/pprof/heap to pprof

func IndexHandler

func IndexHandler() gin.HandlerFunc

IndexHandler will pass the call from /debug/pprof to pprof

func MutexHandler

func MutexHandler() gin.HandlerFunc

MutexHandler will pass the call from /debug/pprof/mutex to pprof

func ProfileHandler

func ProfileHandler() gin.HandlerFunc

ProfileHandler will pass the call from /debug/pprof/profile to pprof

func SymbolHandler

func SymbolHandler() gin.HandlerFunc

SymbolHandler will pass the call from /debug/pprof/symbol to pprof

func ThreadCreateHandler

func ThreadCreateHandler() gin.HandlerFunc

ThreadCreateHandler will pass the call from /debug/pprof/threadcreate to pprof

func TraceHandler

func TraceHandler() gin.HandlerFunc

TraceHandler will pass the call from /debug/pprof/trace to pprof

func WrapGroup

func WrapGroup(router *gin.RouterGroup)

WrapGroup adds several routes from package `net/http/pprof` to *gin.RouterGroup object

func WrapPProf

func WrapPProf(router *gin.Engine)

WrapPProf Wrap adds several routes from package `net/http/pprof` to *gin.Engine object

Types

type Event

type Event func()

Event common event function can be ran before server start, or after server stop.

type Option

type Option func(s *server)

Option is a function to the server for setting options

func AfterStopEventOption

func AfterStopEventOption(events ...Event) Option

AfterStopEventOption set after stop events.

func BeforeStartEventOption

func BeforeStartEventOption(events ...Event) Option

BeforeStartEventOption set before start events.

func EnvOption

func EnvOption(env vars.Env) Option

EnvOption set env for server.

func LoggerOption

func LoggerOption(l log.Logger) Option

LoggerOption set logger to server, server uses it to log result of requests

type RouterFunc

type RouterFunc func(engine *gin.Engine)

RouterFunc is a function resgiter handler to gin.Engine

type Server

type Server interface {
	Init()
	RegisterRouters(regFunc RouterFunc)
	Run(addr string) error
}

Server interface for a basic method of http web server, which can be ran in few step

func New

func New(options ...Option) Server

New return a Server based on Options.

Jump to

Keyboard shortcuts

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