Documentation ¶
Index ¶
- Constants
- Variables
- type APIParams
- type GRPCOption
- type HTTPOption
- type Listener
- type ListenerOption
- type MultiServerParams
- type ServerResult
- type Service
- func New(log *zap.Logger, services ...Service) (Service, error)
- func NewGRPCService(serve *grpc.Server, opts ...GRPCOption) (Service, error)
- func NewHTTPService(serve *http.Server, opts ...HTTPOption) (Service, error)
- func NewListener(lis Listener, opts ...ListenerOption) (Service, error)
- func NewMultiServer(p MultiServerParams) (Service, error)
Constants ¶
const ( // ErrEmptyGRPCServer is raised when called NewGRPCService // or gRPC methods with empty grpc.Server. ErrEmptyGRPCServer = internal.Error("empty gRPC server") // ErrEmptyGRPCAddress is raised when passed empty address to NewGRPCService. ErrEmptyGRPCAddress = internal.Error("empty gRPC address") )
const ( // ErrEmptyHTTPServer is raised when called New // or httpService methods with empty http.Server. ErrEmptyHTTPServer = internal.Error("empty http server") // ErrEmptyHTTPAddress is raised when passed empty address to NewHTTPService. ErrEmptyHTTPAddress = internal.Error("empty http address") )
const ( // ErrEmptyLogger is raised when empty logger passed into New function. ErrEmptyLogger = internal.Error("empty logger") // ErrEmptyServices is raised when empty services passed into New function. ErrEmptyServices = internal.Error("empty services") )
const ErrEmptyListener = internal.Error("empty listener")
ErrEmptyListener is raised when an empty Listener used in the NewListener function or Listener methods.
Variables ¶
var ( // ServersModule of web base structs ServersModule = module.Module{ {Constructor: newDefaultGRPCServer}, {Constructor: newProfileServer}, {Constructor: newMetricServer}, {Constructor: NewAPIServer}, {Constructor: NewMultiServer}, } )
Functions ¶
This section is empty.
Types ¶
type APIParams ¶ added in v0.5.0
type APIParams struct { dig.In Config *viper.Viper Logger *zap.Logger Handler http.Handler `optional:"true"` }
APIParams struct
type GRPCOption ¶ added in v0.13.0
type GRPCOption func(g *gRPC)
GRPCOption allows changing default gRPC service settings.
func GRPCListenAddress ¶ added in v0.13.0
func GRPCListenAddress(addr string) GRPCOption
GRPCListenAddress allows to change network for net.Listener.
func GRPCListenNetwork ¶ added in v0.13.0
func GRPCListenNetwork(network string) GRPCOption
GRPCListenNetwork allows to change default (tcp) network for net.Listener.
func GRPCShutdownTimeout ¶ added in v0.13.0
func GRPCShutdownTimeout(v time.Duration) GRPCOption
GRPCShutdownTimeout changes default shutdown timeout.
func GRPCSkipErrors ¶ added in v0.13.0
func GRPCSkipErrors() GRPCOption
GRPCSkipErrors allows to skip any errors
type HTTPOption ¶ added in v0.13.0
type HTTPOption func(s *httpService)
HTTPOption interface that allows to change default http-service options.
func HTTPListenAddress ¶ added in v0.13.0
func HTTPListenAddress(address string) HTTPOption
HTTPListenAddress allows to change network for net.Listener. By default it takes address from http.Server.
func HTTPListenNetwork ¶ added in v0.13.0
func HTTPListenNetwork(network string) HTTPOption
HTTPListenNetwork allows to change default (tcp) network for net.Listener.
func HTTPShutdownTimeout ¶ added in v0.13.0
func HTTPShutdownTimeout(v time.Duration) HTTPOption
HTTPShutdownTimeout changes default shutdown timeout.
func HTTPSkipErrors ¶ added in v0.13.0
func HTTPSkipErrors() HTTPOption
HTTPSkipErrors allows to skip any errors
type ListenerOption ¶ added in v0.13.0
type ListenerOption func(l *listener)
ListenerOption options that allows to change default settings for Listener service.
func ListenerIgnoreError ¶ added in v0.13.0
func ListenerIgnoreError(errors ...error) ListenerOption
ListenerIgnoreError allows for ignoring all passed errors.
func ListenerShutdownTimeout ¶ added in v0.13.0
func ListenerShutdownTimeout(v time.Duration) ListenerOption
ListenerShutdownTimeout allows changing the default shutdown timeout.
func ListenerSkipErrors ¶ added in v0.13.0
func ListenerSkipErrors() ListenerOption
ListenerSkipErrors allows for ignoring all raised errors.
type MultiServerParams ¶ added in v0.5.0
MultiServerParams struct
type ServerResult ¶ added in v0.5.0
ServerResult struct
func NewAPIServer ¶ added in v0.5.0
func NewAPIServer(p APIParams) (ServerResult, error)
NewAPIServer creates api server by http.Handler from DI container
func NewGRPCServer ¶ added in v0.13.4
NewGRPCServer creates gRPC server that will be embedded info multi-server.
type Service ¶ added in v0.13.0
Service interface that allows start and stop
func NewGRPCService ¶ added in v0.13.0
func NewGRPCService(serve *grpc.Server, opts ...GRPCOption) (Service, error)
NewGRPCService creates gRPC service with passed gRPC options. If something went wrong it returns an error.
func NewHTTPService ¶ added in v0.13.0
func NewHTTPService(serve *http.Server, opts ...HTTPOption) (Service, error)
NewHTTPService creates Service from http.Server and HTTPOption's.
func NewListener ¶ added in v0.13.0
func NewListener(lis Listener, opts ...ListenerOption) (Service, error)
NewListener creates new Listener service and applies passed options to it.
func NewMultiServer ¶ added in v0.5.0
func NewMultiServer(p MultiServerParams) (Service, error)
NewMultiServer returns new multi servers group