Documentation
¶
Index ¶
- func NewLogger(serviceName string, level zerolog.Level) grpclog.LoggerV2
- type Options
- type Service
- func (service *Service) AddEndpoint(pattern string, handler http.Handler)
- func (service *Service) AddEndpointFunc(pattern string, handleFunc http.HandlerFunc)
- func (service *Service) AddGRPCDialOptions(dialOptions ...grpc.DialOption)
- func (service *Service) AddGRPCServerOptions(serverOptions ...grpc.ServerOption)
- func (service *Service) AddGRPCStreamClientInterceptors(streamInterceptors ...grpc.StreamClientInterceptor)
- func (service *Service) AddGRPCStreamServerInterceptors(streamInterceptors ...grpc.StreamServerInterceptor)
- func (service *Service) AddGRPCUnaryClientInterceptors(unaryInterceptors ...grpc.UnaryClientInterceptor)
- func (service *Service) AddGRPCUnaryServerInterceptors(unaryInterceptors ...grpc.UnaryServerInterceptor)
- func (service *Service) AddHTTPMiddlewares(middlewares ...func(http.Handler) http.Handler)
- func (service *Service) AddRuntimeMuxOptions(serveMuxOptions ...runtime.ServeMuxOption)
- func (service *Service) ClientConn() *grpc.ClientConn
- func (service *Service) GRPCServer() *grpc.Server
- func (service *Service) Initialize(ctx context.Context)
- func (service *Service) RuntimeMux() *runtime.ServeMux
- func (service *Service) Start(ctx context.Context, initFn func() error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct { ServiceName string HttpPort int GrpcPort int Logger grpclog.LoggerV2 RuntimeMuxEndpoint string ServerReadTimeout time.Duration ServerWriteTimeout time.Duration ServerReadHeaderTimeout time.Duration NowFunc func() time.Time TLSEnabled bool TlSCertFile string TlSKeyFile string TLSServerName string }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service contains API clients, connections and options for bootstrapping a micro-service.
func NewService ¶
NewService create a micro-service utility store by parsing data from config. Pass nil logger to use default logger
func (*Service) AddEndpoint ¶
AddEndpoint registers the handler for the given pattern. If a handler already exists for pattern, Handle panics.
func (*Service) AddEndpointFunc ¶
func (service *Service) AddEndpointFunc(pattern string, handleFunc http.HandlerFunc)
AddEndpointFunc registers the handler function for the given pattern.
func (*Service) AddGRPCDialOptions ¶
func (service *Service) AddGRPCDialOptions(dialOptions ...grpc.DialOption)
AddGRPCDialOptions adds dial options to the service gRPC reverse proxy client
func (*Service) AddGRPCServerOptions ¶
func (service *Service) AddGRPCServerOptions(serverOptions ...grpc.ServerOption)
AddGRPCServerOptions adds server options to the service gRPC server
func (*Service) AddGRPCStreamClientInterceptors ¶
func (service *Service) AddGRPCStreamClientInterceptors( streamInterceptors ...grpc.StreamClientInterceptor, )
AddGRPCStreamClientInterceptors adds stream interceptors to the service gRPC reverse proxy client
func (*Service) AddGRPCStreamServerInterceptors ¶
func (service *Service) AddGRPCStreamServerInterceptors( streamInterceptors ...grpc.StreamServerInterceptor, )
AddGRPCStreamServerInterceptors adds stream interceptors to the service gRPC server
func (*Service) AddGRPCUnaryClientInterceptors ¶
func (service *Service) AddGRPCUnaryClientInterceptors( unaryInterceptors ...grpc.UnaryClientInterceptor, )
AddGRPCUnaryClientInterceptors adds unary interceptors to the service gRPC reverse proxy client
func (*Service) AddGRPCUnaryServerInterceptors ¶
func (service *Service) AddGRPCUnaryServerInterceptors( unaryInterceptors ...grpc.UnaryServerInterceptor, )
AddGRPCUnaryServerInterceptors adds unary interceptors to the service gRPC server
func (*Service) AddHTTPMiddlewares ¶
AddHTTPMiddlewares adds http middlewares to the service
func (*Service) AddRuntimeMuxOptions ¶
func (service *Service) AddRuntimeMuxOptions(serveMuxOptions ...runtime.ServeMuxOption)
AddRuntimeMuxOptions adds ServeMuxOption options to service gRPC reverse proxy client The options will be applied to the service runtime mux at startup
func (*Service) ClientConn ¶
func (service *Service) ClientConn() *grpc.ClientConn
ClientConn returns the underlying client connection to gRPC server used by reverse proxy
func (*Service) GRPCServer ¶
GRPCServer returns the grpc server for the service
func (*Service) Initialize ¶
Initialize initializes service without starting it.
func (*Service) RuntimeMux ¶
RuntimeMux returns the HTTP request multiplexer for the service reverse proxy server gRPC services and methods are registered on this multiplxer. DO NOT register your anything on the returned muxer Use AddRuntimeMuxOptions method to register custom options