Documentation
¶
Index ¶
- Constants
- type DefaultHttpServerMiddleware
- type GRPCInterceptor
- type GRPCServer
- type GRPCServerOptions
- type HTTPServer
- type HTTPServerHandler
- type HTTPServerOption
- type HTTPServerOptions
- type HttpOptionKind
- type HttpServerMiddleware
- type KindInterceptor
- type KindMiddleware
- type ServerInfo
- type ServerKind
Constants ¶
View Source
const ( ServerKindHTTPServer = "http" ServerKindGRPCServer = "grpc" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DefaultHttpServerMiddleware ¶
type DefaultHttpServerMiddleware struct{}
func (DefaultHttpServerMiddleware) Order ¶
func (DefaultHttpServerMiddleware) Order() int
type GRPCInterceptor ¶
type GRPCInterceptor interface {
Kind() KindInterceptor
Order() int
Interceptor(ctx context.Context, req interface{}, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (resp interface{}, err error)
}
type GRPCServer ¶
type GRPCServer interface {
Start(ctx context.Context) error
Stop() error
SetDescriptor(descriptor grpc.ServiceDesc)
SetService(constructor interface{})
SetConstructor(fn interface{})
GetInterceptors() []interface{}
SetInterceptor(interceptor any)
GetService() interface{}
GetConstructor() interface{}
GetInterceptorsConstructor() interface{}
RegisterService(service interface{})
Info() ServerInfo
}
type GRPCServerOptions ¶
type HTTPServer ¶
type HTTPServer interface {
Start(ctx context.Context) error
Stop(ctx context.Context) error
UseMiddleware(...KindMiddleware)
UseMarshaler(contentType string, marshaler marshaler.Marshaler) error
GetMiddlewares() []any
SetMiddleware(middleware any)
SetService(service interface{})
GetService() interface{}
AddHandler(method, path string, h http.HandlerFunc, opts ...HTTPServerOption)
GetConstructor() interface{}
Subscribe(event string, h websockets.EventHandler)
Info() ServerInfo
ServerWS(w http.ResponseWriter, r *http.Request)
SetCorsHandlerFunc(hf http.HandlerFunc)
SetErrorHandlerFunc(hf func(http.ResponseWriter, error))
}
type HTTPServerHandler ¶
type HTTPServerHandler struct {
Method string
Path string
Handler http.HandlerFunc
Options []HTTPServerOption
}
type HTTPServerOption ¶
type HTTPServerOption interface {
Kind() HttpOptionKind
}
type HTTPServerOptions ¶
type HttpOptionKind ¶
type HttpOptionKind string
type HttpServerMiddleware ¶
type HttpServerMiddleware interface {
Apply(h http.HandlerFunc) http.HandlerFunc
Kind() KindMiddleware
Order() int
}
type KindInterceptor ¶
type KindInterceptor string
type KindMiddleware ¶
type KindMiddleware string
type ServerInfo ¶
type ServerInfo struct {
Kind ServerKind
Host string
Port int
TLSConfig *tls.Config
}
type ServerKind ¶
type ServerKind string
Click to show internal directories.
Click to hide internal directories.