server

package
v0.0.0-...-d62e3dc Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMinDispatchInterval = 0 * time.Millisecond
	DefaultTimeout             = 60 * time.Second
)

Variables

View Source
var (
	ErrTooOften = errors.New("too often")
)

Functions

This section is empty.

Types

type Context

type Context = gin.Context

type HandleOptionFunc

type HandleOptionFunc func(option *HandlerOption)

func WithMinDispatchInterval

func WithMinDispatchInterval(minDispatchInterval time.Duration) HandleOptionFunc

func WithRequestQueued

func WithRequestQueued(queued bool) HandleOptionFunc

func WithTimeout

func WithTimeout(timeout time.Duration) HandleOptionFunc

type HandlerFunc

type HandlerFunc = gin.HandlerFunc

func TraceRequestBody

func TraceRequestBody(logger slog.ILogger) HandlerFunc

type HandlerOption

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

func NewHandlerOption

func NewHandlerOption(optionFuncs ...HandleOptionFunc) *HandlerOption

func (HandlerOption) MinDispatchInterval

func (o HandlerOption) MinDispatchInterval() time.Duration

func (HandlerOption) Timeout

func (o HandlerOption) Timeout() time.Duration

type Server

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

func New

func New(rootContext *sadefine.RootContext, pid *sadefine.PID, logger slog.ILogger) *Server

func (*Server) ListenAndServe

func (s *Server) ListenAndServe(addr string) (listenAddr string, err error)

func (*Server) ListenAndServeTLS

func (s *Server) ListenAndServeTLS(addr string, certFile string, keyFile string) (listenAddr string, err error)

func (*Server) Listener

func (s *Server) Listener() net.Listener

func (*Server) MustRegisterHandler

func (s *Server) MustRegisterHandler(method string, pattern string, option *HandlerOption, funcs ...HandlerFunc)

Jump to

Keyboard shortcuts

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