webserve

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Server)

Option for queue system

func WithHandler

func WithHandler(handler http.Handler) Option

WithHandler set handler function

func WithHost

func WithHost(host string) Option

WithHost set host function

func WithHttpServer

func WithHttpServer(httpServer http.Server) Option

WithHttpServer set httpServer function

func WithLogger

func WithLogger(logger glog.ILogger) Option

WithLogger set logger function

func WithMaxHeaderBytes

func WithMaxHeaderBytes(maxHeaderBytes int) Option

WithMaxHeaderBytes set maxHeaderBytes function

func WithPort

func WithPort(port int) Option

WithPort set port function

func WithProtocol

func WithProtocol(protocol string) Option

WithProtocol set protocol function

func WithReadTimeout

func WithReadTimeout(readTimeout time.Duration) Option

WithReadTimeout set readTimeout function

func WithServiceName

func WithServiceName(serviceName string) Option

WithServiceName set serviceName function

func WithVersion

func WithVersion(version string) Option

WithVersion set version function

func WithWriterTimeout

func WithWriterTimeout(writerTimeout time.Duration) Option

WithWriterTimeout set writerTimeout function

type Server

type Server struct {
	Ctx         context.Context
	Tracer      *tracer.Server
	Logger      glog.ILoggerEntry
	ServiceName string
	Host        string
	Port        int

	Version string
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) *Server

func (*Server) AddDiscovery

func (s *Server) AddDiscovery(client discovery.Discovery) *Server

func (*Server) AddHandler

func (s *Server) AddHandler(handler http.Handler) *Server

func (*Server) AddTrace

func (s *Server) AddTrace(tracer *tracer.Server) *Server

func (*Server) HostInfo added in v0.4.7

func (s *Server) HostInfo() *host.InfoStat

func (*Server) IsDevelopment

func (s *Server) IsDevelopment() bool

func (*Server) IsProduction

func (s *Server) IsProduction() bool

func (*Server) IsTest

func (s *Server) IsTest() bool

func (*Server) PrintHostInfo added in v0.4.6

func (s *Server) PrintHostInfo()

func (*Server) Run

func (s *Server) Run()

func (*Server) SetRunMode

func (s *Server) SetRunMode(mode string)

func (*Server) Shutdown

func (s *Server) Shutdown()

func (*Server) StopNotify

func (s *Server) StopNotify(sig os.Signal)

Jump to

Keyboard shortcuts

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